prithivMLmods commited on
Commit
1fc1a44
·
verified ·
1 Parent(s): a9f9913

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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; rv:109.0) Gecko/20100101 Firefox/111.0"},
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; rv:109.0) Gecko/20100101 Firefox/111.0"}, 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:
 
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: