I have the following search term
navigator.geolocation.getCurrentPosition
which return 271,769 code results, how I can return the code results number by using github API
I have the following search term
navigator.geolocation.getCurrentPosition
which return 271,769 code results, how I can return the code results number by using github API
You can use the GitHub Search API to search code. More precisely, the following endpoint:
[GET] /search/code
Since you are only interested in the total number, you can set the per_page
parameter to 1 in order to make the the result smaller. The number of results is returned in the response as total_count
:
{
"total_count": 435249,
"incomplete_results": false,
"items": [
...
]
}
Example using the GitHub command line tool:
gh api -X GET search/code -f q='navigator.geolocation.getCurrentPosition' -f per_page='1'