Spaces:
Paused
Paused
Download search.py from andronasef/googleit-server: direct link, hf CLI and curl.
- Browser
- Download file 560 Bytes
-
https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/search.py
- Command line
-
hf download hf://spaces/andronasef/googleit-server/search.py
-
curl -L -o search.py https://huggingface.co/spaces/andronasef/googleit-server/resolve/main/search.py
560 Bytes
| from proxy import getProxy | |
| from searchlib import search as googlesearch | |
| def search(query): | |
| results = {} | |
| counter = 0 | |
| for searchObj in googlesearch(query, advanced=True, proxy=getProxy()): | |
| newObj = { | |
| "title": searchObj.title, | |
| "description": searchObj.description, | |
| "url": searchObj.url | |
| } | |
| results[counter] = newObj | |
| counter = counter + 1 | |
| return results | |
| def test_search(): | |
| query = "python programming" | |
| results = search(query) | |
| return results | |
| # print(test_search()) | |