github-search-zh / test_gh_syntax.py
Lowking's picture
Direct update with gemini-3.6-flash model and SOP settings
64e6d24
Raw
History Blame Contribute Delete
737 Bytes
import urllib.request, urllib.parse, json
queries = [
'("ocr" OR "optical character recognition") in:name,description',
'"ocr" OR "optical character recognition" in:name,description',
'ocr OR "optical character recognition"',
'ocr in:name,description'
]
for q in queries:
url = 'https://api.github.com/search/repositories?q=' + urllib.parse.quote(q)
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0', 'Accept':'application/vnd.github.v3+json'})
try:
with urllib.request.urlopen(req) as r:
data = json.loads(r.read())
print(f"Query: {q}")
print(f"Count: {data['total_count']}\n")
except Exception as e:
print(f"Error on {q}: {e}")