Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def search(query):
|
|
28 |
with requests.Session() as session:
|
29 |
resp = session.get(
|
30 |
url="https://www.google.com/search",
|
31 |
-
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64
|
32 |
params={"q": term, "num": 3, "udm": 14},
|
33 |
timeout=5,
|
34 |
verify=None,
|
@@ -40,7 +40,7 @@ def search(query):
|
|
40 |
link = result.find("a", href=True)
|
41 |
link = link["href"]
|
42 |
try:
|
43 |
-
webpage = session.get(link, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64
|
44 |
webpage.raise_for_status()
|
45 |
visible_text = extract_text_from_webpage(webpage.text)
|
46 |
if len(visible_text) > max_chars_per_page:
|
|
|
28 |
with requests.Session() as session:
|
29 |
resp = session.get(
|
30 |
url="https://www.google.com/search",
|
31 |
+
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"},
|
32 |
params={"q": term, "num": 3, "udm": 14},
|
33 |
timeout=5,
|
34 |
verify=None,
|
|
|
40 |
link = result.find("a", href=True)
|
41 |
link = link["href"]
|
42 |
try:
|
43 |
+
webpage = session.get(link, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"}, timeout=5, verify=False)
|
44 |
webpage.raise_for_status()
|
45 |
visible_text = extract_text_from_webpage(webpage.text)
|
46 |
if len(visible_text) > max_chars_per_page:
|