Skip to content

Instantly share code, notes, and snippets.

@usametov
Created February 16, 2021 01:50
Show Gist options
  • Star 42 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save usametov/af8f13a351a66fb05a9895f11417dd9d to your computer and use it in GitHub Desktop.
Save usametov/af8f13a351a66fb05a9895f11417dd9d to your computer and use it in GitHub Desktop.
how to search github.com for multiple topics
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}'
@jdheyburn
Copy link

Nice 👍

@chmac
Copy link

chmac commented Aug 10, 2021

I'm able to search GitHub like topic:go topic:ecs and I seem to get only results that include both topics. I got the tip from your gist, thanks! 👍

@usametov
Copy link
Author

I'm able to search GitHub like topic:go topic:ecs and I seem to get only results that include both topics. I got the tip from your gist, thanks! 👍

thanks, that's a good idea!

@billmetangmo
Copy link

Awesome . Thanks !

@wobsoriano
Copy link

thanks

@surfmuggle
Copy link

surfmuggle commented Sep 21, 2022

@chmac This is great.

This is how it looks like

image

And this is the matching url https://github.com/search?q=topic%3Agui+topic%3Aterminal+topic%3Acurses

@behnam7171
Copy link

Your answers are AND operator between topics.
How about the OR operator between topics? any ideas on that?

@arivasnxt
Copy link

arivasnxt commented Aug 16, 2023

I'd like to use the OR operator for topics @behnam7171, but I haven't found a way yet

@schnell18
Copy link

OR operator is not supported in REST API, you have to issue multiple calls and combine the result. @behnam7171 @arivasnxt

@schnell18
Copy link

schnell18 commented Sep 19, 2023 via email

@usametov
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment