【问题标题】:Get GitHub Gist Stargazer Count获取 GitHub Gist Stargazer Count
【发布时间】:2015-07-03 05:55:41
【问题描述】:

我可以通过这个获取存储库的观星者计数。

curl https://api.github.com/repos/mottosso/be/stargazers

但是我怎样才能获得 Gist 的观星者呢?

例如

curl https://api.github.com/gists/mottosso/9b25f547d5364f050494/stargazers

【问题讨论】:

    标签: github-api


    【解决方案1】:

    这似乎不能直接在要点上提供。
    你可以check if a gist is starred,但是像richardcornish/file-git-notes 这样的加星号的要点在其描述中不包括星号。

    https://api.github.com/gists/4676556

    这会让您放弃 https://gist.github.com/richardcornish/4676556/stars 页面以获得“36”(该要点的总星数)。

    而且那个计数器的 xpath 不是一个明显的

    //div[@id='js-flash-container']/
    div[@class='container']/
    div[@class='gist js-gist-container gist-with-sidebar with-full-navigation']/
    div[@class='gist-sidebar clearfix']/
    div[@class='sunken-menu vertical-right repo-nav js-repo-nav js-repository-container-pjax js-octicon-loaders']/
    div[@class='sunken-menu-contents']/
    ul[@class='sunken-menu-group']/
    li[@class='tooltipped tooltipped-w'][3]/
    a[@class='sunken-menu-item selected']/
    span[@class='counter']
    

    【讨论】:

    • 感谢您对 VonC 的确认,接下来我会采纳您的建议。
    猜你喜欢
    • 2021-05-28
    • 2017-06-20
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-15
    • 2018-02-15
    相关资源
    最近更新 更多