prithivMLmods commited on
Commit
c88233e
·
verified ·
1 Parent(s): 4237af4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -28,7 +28,7 @@ def perform_search(query):
28
  with requests.Session() as session:
29
  response = session.get(
30
  url="https://www.google.com/search",
31
- headers={"User-Agent": "Mozilla/5.0"},
32
  params={"q": search_term, "num": 3, "udm": 14},
33
  timeout=5,
34
  verify=False,
@@ -39,7 +39,7 @@ def perform_search(query):
39
  for result in result_block:
40
  link = result.find("a", href=True)["href"]
41
  try:
42
- webpage_response = session.get(link, headers={"User-Agent": "Mozilla/5.0"}, timeout=5, verify=False)
43
  webpage_response.raise_for_status()
44
  visible_text = get_text_from_html(webpage_response.text)
45
  if len(visible_text) > max_chars_per_page:
 
28
  with requests.Session() as session:
29
  response = 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 Edg/111.0.0.0"},
32
  params={"q": search_term, "num": 3, "udm": 14},
33
  timeout=5,
34
  verify=False,
 
39
  for result in result_block:
40
  link = result.find("a", href=True)["href"]
41
  try:
42
+ webpage_response = 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 Edg/111.0.0.0"}, timeout=5, verify=False)
43
  webpage_response.raise_for_status()
44
  visible_text = get_text_from_html(webpage_response.text)
45
  if len(visible_text) > max_chars_per_page: