Based on the v3 documentation I would have thought that this:
$ curl https://api.github.com/legacy/repos/search/python?language=Python&sort=forks&order=desc
would return the top 100 Python repositories in descending order of number of forks. It actually returns an empty (json) list of repositories.
This:
$ curl https://api.github.com/legacy/repos/search/python?language=Python&sort=forks
returns a list of repositories (in json), but many of them are not listed as Python repositories.
So, clearly I have misunderstood the Github API. What is the accepted way of retrieving the top N repositories for a particular language?
As pengwynn said -- currently this is not easily doable via GitHub's API alone. However, have a look at this alternative way of querying using the GitHub Archive project: How to find the 100 largest GitHub repositories for a past date?
In essence, you can query GitHub's historical data using an SQL-like language. So, if having real-time results is not something that is important for you, you could execute the following query on https://bigquery.cloud.google.com/?pli=1 to get the top 100 Python repos as on April 1st 2013 (yesterday), descending by the number of forks:
SELECT MAX(repository_forks) as forks, repository_url
FROM [githubarchive:github.timeline]
WHERE (created_at CONTAINS "2013-04-01" and repository_language = "Python")
GROUP BY repository_url
ORDER BY forks
DESC LIMIT 100
I've put the results of the query in this Gist in CSV format, and the top few repos are:
forks repository_url
1913 https://github.com/django/django
1100 https://github.com/facebook/tornado
994 https://github.com/mitsuhiko/flask
...
The intent of Repository Search API is to find Repositories by keyword and then further filter those results by the other optional query string parameters.
Since you're missing a ?
, you're passing the entire intended query string as the :keyword
. I'm sorry, we do not support your intended search via the GitHub API at this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With