Answer a question

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)

  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.

Answers

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

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐