Created
February 16, 2021 01:50
-
-
Save usametov/af8f13a351a66fb05a9895f11417dd9d to your computer and use it in GitHub Desktop.
how to search github.com for multiple topics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Github.com ui .currently does not natively supoport search for multiple topic tags as of now. However their api allows you to query multiple tags. Below is a simple example to query github.com with ecs and go topic tags. | |
curl -H "Accept: application/vnd.github.mercy-preview+json" \ | |
https://api.github.com/search/repositories?q=topic:ecs+topic:go | |
Response from the github can be rather verbose so lets filter only relavant info such repo url and description. | |
curl -H "Accept: application/vnd.github.mercy-preview+json" \ | |
https://api.github.com/search/repositories\?q\=topic:ecs+topic:go | jq '.items[] | {url:.url, description:.description}' | |
Thanks for the information!
The method works for topics less than 7, otherwise github API complains:
More than five AND / OR / NOT operators were used.
…On Tue, Sep 19, 2023 at 6:58 AM Amos Boldor ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@behnam7171 <https://github.com/behnam7171> @arivasnxt
<https://github.com/arivasnxt> @schnell18 <https://github.com/schnell18>
With the in qualifier you can restrict your search to the repository
name, repository description, repository *topics*, contents of the README
file, or any combination of these.
<https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories#search-by-repository-name-description-or-contents-of-the-readme-file>
react OR angular OR python in:topics
react OR angular OR python in:topics
<https://github.com/search?q=react+OR+angular+OR+python+in%3Atopics&type=repositories>
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/usametov/af8f13a351a66fb05a9895f11417dd9d#gistcomment-4696337>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABU2Z6F4AKOIYWTQA2TWGLX3CKU3BFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTANZZGQ4DMOBUU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
seems like there is a better way of calling github api. check this out:
https://github.com/octokit/octokit.js
it works with github graphql
With GitHub CLI, it looks like this can be done with:
gh search repos --topic ecs --topic go
or if you want JSON and/or additional fields:
gh search repos --topic ecs --topic go --json url,description,stargazersCount,createdAt,updatedAt
AND
is implied with multiple --topic
parameters and the default sort order is the number of stars
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OR operator is not supported in REST API, you have to issue multiple calls and combine the result. @behnam7171 @arivasnxt