github search limit results

前端 未结 2 1860
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 14:42

I need to do a very large search on Github for a statistic in my thesis.

For example, I need to explore a large number of Android projects on GitHub, but the site l

相关标签:
2条回答
  • If you are searching for all files in Github with filename:your-file-name, you could also slice it with a query attribute : size.

    For example, you are looking for all files named test.rb in Github, Github API may return more than 11M results, but you could only get 1000 of them because the GitHub Search API provides up to 1,000 results for each search. An url like : https://api.github.com/search/code?q=filename:test.rb+size:1000..1500 would be able to slice your search by changing size range.

    0 讨论(0)
  • 2020-12-05 15:31

    The Search API will return up to 1000 results per query (including pagination), as documented here:

    https://developer.github.com/v3/search/#about-the-search-api

    However, there's a neat trick you could use to fetch more than 1000 results when executing a repository search. You could split up your search into segments, by the date when the repositories were created. For example, you could first search for repositories that were created in the first week of October 2013, then second week, then September, and so on.

    Because you would be restricting search to a narrow period, you will probably get less than 1000 results, and would therefore be able to get all of them. In case you notice that more than 1000 results are returned for a period, you would have to narrow the period even more, so that you can collect all results.

    https://help.github.com/articles/searching-repositories/#search-based-on-when-a-repository-was-created-or-last-updated

    You should be able to automate this via the API.

    0 讨论(0)
提交回复
热议问题