Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -392,7 +392,7 @@ async def google_search(q: str, delimiter: str = "\n---\n", sites: Annotated[lis
|
|
392 |
|
393 |
|
394 |
@app.get("/google_search_urls")
|
395 |
-
async def google_search_url(q: str, sites: Annotated[list[str] | None, Query()] = None, start:int = 0):
|
396 |
url = f"https://www.google.com/search?start={start}&q={q} "
|
397 |
|
398 |
if sites:
|
@@ -401,7 +401,7 @@ async def google_search_url(q: str, sites: Annotated[list[str] | None, Query()]
|
|
401 |
res = requests.get(
|
402 |
url,
|
403 |
headers={
|
404 |
-
"user-agent":
|
405 |
"accept-language": "en-US"
|
406 |
},
|
407 |
timeout=(10, 27),
|
|
|
392 |
|
393 |
|
394 |
@app.get("/google_search_urls")
|
395 |
+
async def google_search_url(q: str, sites: Annotated[list[str] | None, Query()] = None, start:int = 0, user_agent="Twitterbot"):
|
396 |
url = f"https://www.google.com/search?start={start}&q={q} "
|
397 |
|
398 |
if sites:
|
|
|
401 |
res = requests.get(
|
402 |
url,
|
403 |
headers={
|
404 |
+
"user-agent": user_agent,
|
405 |
"accept-language": "en-US"
|
406 |
},
|
407 |
timeout=(10, 27),
|