X-lab2017 / od-api

A repository for transforming response data format from open-digger
5 stars 2 forks source link

[feature] 定时获取项目的总 star 和 fork 数 #9

Closed zhicheng-ning closed 1 year ago

zhicheng-ning commented 1 year ago

通过 GitHub API 获取实时的项目总 star 和 fork 数

zhicheng-ning commented 1 year ago

eg:

https://api.github.com/repos/X-lab2017/open-digger

response:

{
"id": 288431943,
"node_id": "MDEwOlJlcG9zaXRvcnkyODg0MzE5NDM=",
"name": "open-digger",
"full_name": "X-lab2017/open-digger",
"private": false,
"owner": {},
"html_url": "https://github.com/X-lab2017/open-digger",
"description": "Open source analysis tools",
"fork": false,
"url": "https://api.github.com/repos/X-lab2017/open-digger",
"forks_url": "https://api.github.com/repos/X-lab2017/open-digger/forks",
"keys_url": "[https://api.github.com/repos/X-lab2017/open-digger/keys{/key_id}](https://api.github.com/repos/X-lab2017/open-digger/keys%7B/key_id%7D)",
"collaborators_url": "[https://api.github.com/repos/X-lab2017/open-digger/collaborators{/collaborator}](https://api.github.com/repos/X-lab2017/open-digger/collaborators%7B/collaborator%7D)",
"teams_url": "https://api.github.com/repos/X-lab2017/open-digger/teams",
"hooks_url": "https://api.github.com/repos/X-lab2017/open-digger/hooks",
"issue_events_url": "[https://api.github.com/repos/X-lab2017/open-digger/issues/events{/number}](https://api.github.com/repos/X-lab2017/open-digger/issues/events%7B/number%7D)",
"events_url": "https://api.github.com/repos/X-lab2017/open-digger/events",
"assignees_url": "[https://api.github.com/repos/X-lab2017/open-digger/assignees{/user}](https://api.github.com/repos/X-lab2017/open-digger/assignees%7B/user%7D)",
"branches_url": "[https://api.github.com/repos/X-lab2017/open-digger/branches{/branch}](https://api.github.com/repos/X-lab2017/open-digger/branches%7B/branch%7D)",
"tags_url": "https://api.github.com/repos/X-lab2017/open-digger/tags",
"blobs_url": "[https://api.github.com/repos/X-lab2017/open-digger/git/blobs{/sha}](https://api.github.com/repos/X-lab2017/open-digger/git/blobs%7B/sha%7D)",
"git_tags_url": "[https://api.github.com/repos/X-lab2017/open-digger/git/tags{/sha}](https://api.github.com/repos/X-lab2017/open-digger/git/tags%7B/sha%7D)",
"git_refs_url": "[https://api.github.com/repos/X-lab2017/open-digger/git/refs{/sha}](https://api.github.com/repos/X-lab2017/open-digger/git/refs%7B/sha%7D)",
"trees_url": "[https://api.github.com/repos/X-lab2017/open-digger/git/trees{/sha}](https://api.github.com/repos/X-lab2017/open-digger/git/trees%7B/sha%7D)",
"statuses_url": "[https://api.github.com/repos/X-lab2017/open-digger/statuses/{sha}](https://api.github.com/repos/X-lab2017/open-digger/statuses/%7Bsha%7D)",
"languages_url": "https://api.github.com/repos/X-lab2017/open-digger/languages",
"stargazers_url": "https://api.github.com/repos/X-lab2017/open-digger/stargazers",
"contributors_url": "https://api.github.com/repos/X-lab2017/open-digger/contributors",
"subscribers_url": "https://api.github.com/repos/X-lab2017/open-digger/subscribers",
"subscription_url": "https://api.github.com/repos/X-lab2017/open-digger/subscription",
"commits_url": "[https://api.github.com/repos/X-lab2017/open-digger/commits{/sha}](https://api.github.com/repos/X-lab2017/open-digger/commits%7B/sha%7D)",
"git_commits_url": "[https://api.github.com/repos/X-lab2017/open-digger/git/commits{/sha}](https://api.github.com/repos/X-lab2017/open-digger/git/commits%7B/sha%7D)",
"comments_url": "[https://api.github.com/repos/X-lab2017/open-digger/comments{/number}](https://api.github.com/repos/X-lab2017/open-digger/comments%7B/number%7D)",
"issue_comment_url": "[https://api.github.com/repos/X-lab2017/open-digger/issues/comments{/number}](https://api.github.com/repos/X-lab2017/open-digger/issues/comments%7B/number%7D)",
"contents_url": "[https://api.github.com/repos/X-lab2017/open-digger/contents/{+path}](https://api.github.com/repos/X-lab2017/open-digger/contents/%7B+path%7D)",
"compare_url": "[https://api.github.com/repos/X-lab2017/open-digger/compare/{base}...{head}](https://api.github.com/repos/X-lab2017/open-digger/compare/%7Bbase%7D...%7Bhead%7D)",
"merges_url": "https://api.github.com/repos/X-lab2017/open-digger/merges",
"archive_url": "[https://api.github.com/repos/X-lab2017/open-digger/{archive_format}{/ref}](https://api.github.com/repos/X-lab2017/open-digger/%7Barchive_format%7D%7B/ref%7D)",
"downloads_url": "https://api.github.com/repos/X-lab2017/open-digger/downloads",
"issues_url": "[https://api.github.com/repos/X-lab2017/open-digger/issues{/number}](https://api.github.com/repos/X-lab2017/open-digger/issues%7B/number%7D)",
"pulls_url": "[https://api.github.com/repos/X-lab2017/open-digger/pulls{/number}](https://api.github.com/repos/X-lab2017/open-digger/pulls%7B/number%7D)",
"milestones_url": "[https://api.github.com/repos/X-lab2017/open-digger/milestones{/number}](https://api.github.com/repos/X-lab2017/open-digger/milestones%7B/number%7D)",
"notifications_url": "[https://api.github.com/repos/X-lab2017/open-digger/notifications{?since,all,participating}](https://api.github.com/repos/X-lab2017/open-digger/notifications%7B?since,all,participating})",
"labels_url": "[https://api.github.com/repos/X-lab2017/open-digger/labels{/name}](https://api.github.com/repos/X-lab2017/open-digger/labels%7B/name%7D)",
"releases_url": "[https://api.github.com/repos/X-lab2017/open-digger/releases{/id}](https://api.github.com/repos/X-lab2017/open-digger/releases%7B/id%7D)",
"deployments_url": "https://api.github.com/repos/X-lab2017/open-digger/deployments",
"created_at": "2020-08-18T11:03:58Z",
"updated_at": "2023-01-31T18:28:32Z",
"pushed_at": "2023-02-03T09:58:28Z",
"git_url": "git://github.com/X-lab2017/open-digger.git",
"ssh_url": "git@github.com:X-lab2017/open-digger.git",
"clone_url": "https://github.com/X-lab2017/open-digger.git",
"svn_url": "https://github.com/X-lab2017/open-digger",
"homepage": "http://www.x-lab.info/open-digger",
"size": 58789,
"stargazers_count": 227,
"watchers_count": 227,
"language": "Jupyter Notebook",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": true,
"has_discussions": true,
"forks_count": 60,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 16,
"license": {},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [
"data-analysis",
"github",
"hacktoberfest",
"openrank"
],
"visibility": "public",
"forks": 60,
"open_issues": 16,
"watchers": 227,
"default_branch": "master",
"temp_clone_token": null,
"organization": {},
"network_count": 60,
"subscribers_count": 23
}

我们能获取 stargazers_count 和 forks_count 从而拿到项目的 star 总数和 fork 总数