Search code examples
pythongithub-pagesgithub-api

How to extract all repositories from GitHub given some criteria?


I want to extract all GitHub repositories that have the following criteria:

  1. written in Python
  2. used the numpy package
  3. created after 2015

Currently, I am using the following query:

https://api.github.com/legacy/repos/search/numpy%20in:name,description&python?language=python&per_page=50&page=1

But, every time I change the page parameter, I get the same repositories in the response. How do I resolve this?


Solution

  • The documentation for the GitHub API says that you should use the GET /search/repositories endpoint, rather than GET /legacy/repos/search.

    The following:

    https://api.github.com/search/repositories?q=numpy%20in:name,description&python?language=python&per_page=50&page=1
    

    returns results that are paginated correctly.