Spaces:
Running
Running
| import urllib.request, urllib.parse, json | |
| queries = [ | |
| 'OCR', | |
| '("ocr" OR "optical character recognition" OR "text recognition" OR "ocr tool") in:name,description,readme' | |
| ] | |
| 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}") | |