开发者

How to list all GitHub users?

I'm working on a site, need to cr开发者_如何学Goawl 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)

  1. I had send email to GitHub support, and got no answer currently.
  2. 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 Archive

https://www.githubarchive.org/

This project can be used to quickly get a dump of all usernames who have ever done anything public.

It exports the GitHub events API to a Google BigQuery dataset frequently.

The data format starting from 2015 is:

SELECT
    actor.login
FROM (
    TABLE_DATE_RANGE([githubarchive:day.events_],
        TIMESTAMP('2015-01-01'),
        TIMESTAMP('2015-01-02')
    ))
GROUP BY actor.login
ORDER BY actor.login

and there is more data starting from 2011-02-12 in a different format, should be easy to figure it out.

Downloading the data takes some fighting with Google BigQuery but is doable: How to download all data in a Google BigQuery dataset?

I have used a similar method to extract all GitHub commit emails at: https://github.com/cirosantilli/all-github-commit-emails


https://api.github.com/search/users?q={query}{&page,per_page,sort,order}

Please check https://developer.github.com/v3/search/ for more details


Note that since May 2013, you now can extract a lot more information from a repository.
See "File CRUD and repository statistics now available in the API"

We're using the repository statistics API to power our graphs, but we can't wait to see what others do with this information.

Starting today, these resources are available to you:

  • Contributors
  • Commit Activity
  • Code Frequency
  • Participation
  • Punch Card


Team wise list the users:-

curl -H "Authorization: token [yours]" https://api.github.com/user/teams

With the following cmd, you can list all the users of github.

curl -H "Authorization: token fkslsml4442323wdsfsdf" https://api.github.com/orgs/cloudaws/members?page=1 | grep login >> github.txt


You probably like to checkout this post - https://github.com/blog/643-contributors

The api call can be made like this:

http://github.com/api/v2/json/repos/show/<user>/<repository-name>/contributors

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜