Search multiple queries in multiple repos

I have a list of repos that I searched for using the Github API. They are all repos in a specific organization and have a keyword in common in their name or description. I added the URLs of these repos to a list and now I need to use that list to refine my search even further.

The new search I need to do is for multiple keywords and search each repo in my list. But I only see searching code in the documentation. And I see the search method path:DIRECTORY looks like what I want. But I’m not sure how to insert that into an API call.

I was thinking to search with multiple queries, I can use this:

terms = 'word 1+word 2+http:\/\/someaddress.withkeyword.com+word-with-hyphen+more words'

But then how do I construct the whole thing? Can I concatenate directories too? Maybe this:

directories = 'repo address 1+repo address 2+repo address 3'

`https://api.github.com/search/code?q=terms path:directories`

I have about 130 repos to search through (and need all of their subfolders searched too), but this is the only way I can think of to fit everything into one API call. Is there a better way?

Thanks!

@andreagriffiths11 maybe you know! :slight_smile: