如何列出所有GitHub用户? [英] How to list all GitHub users?
问题描述
我在一个网站上工作,需要从GitHub抓取所有用户信息(至少是我们网站上的用户)。我搜索了GitHub API,但没有找到答案。
那么有什么方法可以完成这项工作吗?
我只有用户的电子邮件。 (我可以通过比较电子邮件哈希与gravatar URL来检查用户)
- 我已经发送电子邮件给GitHub支持,但目前没有答案。
- 我只需要知道用户名,我就可以使用GitHub API获取其他信息。 >解决方案
正如这里所述,您可以依靠这两个以下API检索JSON格式的输出。根据要求,他们都提供gravatar URL。
合作者(项目组织成员)
- 语法: repos / show /:user /:回购/合作者[GET] 例如: https://api.github.com/repos/git / git /协作者
- 语法: repos / show /:user /:回购/贡献者[GET] $ b
- 示例: https://api.github .com / repos / git / git / contributors
- 语法: / api / v2 / xml / user / email /:email [GET]
- 示例: https://github.com/api/v2/xml/user/email/tom@github.com
$ b
贡献者(作者,至少一次提交)
更新:
先前的API方法要求您从已知的存储库启动。
以下两个提议试图解决这个约束。他们依赖以前版本的API(v2)。
通过电子邮件查询(在您的问题中,您声明我只有用户的电子邮件。。一些关于用户使用电子邮件作为查询参数的信息)
$ ul
搜索存储库(给定一些关键字(language,stack,...)检索存储库列表,使用两个第一个提议,列出他们的合作者和/或贡献者) / api / v2 / json / repos / search /:这里+去+你的+关键字[GET]
注意:确保API的预期用途在符合 GitHub服务条款
I'm working on a site, need to crawl all user information (at least the user on our site) from GitHub. I searched GitHub API, and found no answer.
So is there any way I can do this job? I only have the users emails. (I can check user by compare the email hash with gravatar URL)
- I had send email to GitHub support, and got no answer currently.
- I only need know the usernames, I can use GitHub API to get other informations.
As described here you may rely on those two following APIs to retrieve a JSON formatted output. As requested, both of them provide the gravatar URL.
Collaborators (members of the organization on the project)
- syntax: repos/show/:user/:repo/collaborators [GET]
- example: https://api.github.com/repos/git/git/collaborators
Contributors (authors of, at least, one commit)
- syntax: repos/show/:user/:repo/contributors [GET]
- example: https://api.github.com/repos/git/git/contributors
UPDATE:
The previous API methods requires that you start from a known repository. The two following proposals try to work around this constraint. They rely on the previous version of the API (v2)
Query by email (in your question, you state "I only have the users emails.". Provided the users agreed to publish them you should be able to retreive some information about the user using the email as a query parameter)
- syntax: /api/v2/xml/user/email/:email [GET]
- example: https://github.com/api/v2/xml/user/email/tom@github.com
Search for repositories (given some keywords (language, stack, ...) retrieve a list of repositories. Then, for each one, using the two first proposals, list their collaborators and/or contributors)
- syntax: /api/v2/json/repos/search/:here+go+your+keywords [GET]
- example: https://github.com/api/v2/json/repos/search/stackoverflow
Note: Make sure that intended usage of the API is in concordance with GitHub Terms of service
这篇关于如何列出所有GitHub用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!