Github 官方提供了很多 API ,可以用于获取很多 Github 上公开的用户和仓库信息。
这是官方文档:GitHub REST API documentation - GitHub Docs
其中有根据用户名获取用户详细信息的接口,可以拿到指定用户的Follower、Following、PublicRepos等等的数量,但奇怪的是,拿不到该用户的 Starred 仓库数量。
如下是获取用户信息接口的响应数据示例:
json{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"name": "monalisa octocat",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "[email protected]",
"hireable": false,
"bio": "There once was...",
"twitter_username": "monatheoctocat",
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2008-01-14T04:33:35Z"
}
当然想要获取也有别的方法,如通过 Starred 的仓库列表接口汇总,最后得出一个总数,那就是该用户的总 Starred 数量,但是这样有一个问题,那就是不确定要调用多少次接口。由于Github的分页接口最大单页数量是100,所以使用此方法获取数量时,Starred的仓库越多,相应需要调用接口的次数越多。
有没有只需要调用一次接口就可以拿到 Starred 数量的方法呢?有大佬找到了方法!
本文用于记录Dockerfile中 COPY 指令的常见用法。
COPY大家可能都知道,是用来将文件复制到容器内的,但是针对不同的文件有不同的用法。
本文目前主要记录了:
在 Java 编程中,NullPointerException(空指针异常)是一种常见的运行时异常,经常困扰着开发人员。本文将探讨 NullPointerException 的原因、解决方法以及如何避免这种异常的发生。
老狗的性格测试结果是【INFJ-A】提倡者。
![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
对待人们就像对待他们应该成为的人一样,您可以帮助他们成为他们有能力成为的人。
约翰·沃尔夫冈·冯·歌德
倡导者可能是最稀有的人格类型,但他们肯定会在世界上留下自己的印记。他们理想主义、有原则,不满足于平平安安地度过一生--他们想要站起来,有所作为。对于倡导者来说,成功不是来自金钱或地位,而是来自寻求成就感,帮助他人,成为世界上一股向善的力量。
他们有远大的目标和抱负,倡导者不应该被误认为是无所事事的梦想家。这种性格类型的人关心的是事情的本真,直到他们做了他们认为正确的事情,才会满足。他们对自己的价值观有着清醒的认识,他们在生活中兢兢业业,他们的目标是永远不会忽视真正重要的东西--不是根据其他人或整个社会,而是根据自己的智慧和直觉。