Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,11 @@ app.add_middleware(
|
|
22 |
|
23 |
|
24 |
@app.get("/google_search")
|
25 |
-
async def google_search(q: str):
|
26 |
-
url = f"https://www.google.com/search?q={
|
|
|
|
|
|
|
27 |
texts = ""
|
28 |
soup = BeautifulSoup(requests.get(url).content, "html.parser")
|
29 |
|
|
|
22 |
|
23 |
|
24 |
@app.get("/google_search")
|
25 |
+
async def google_search(q: str, sites: list):
|
26 |
+
url = f"https://www.google.com/search?q={q}"
|
27 |
+
if sites:
|
28 |
+
url += "&" + " OR ".join(["site:"+site for site in sites])
|
29 |
+
|
30 |
texts = ""
|
31 |
soup = BeautifulSoup(requests.get(url).content, "html.parser")
|
32 |
|