Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def extract_text_from_webpage(html_content):
|
|
44 |
visible_text = soup.get_text(strip=True)
|
45 |
return visible_text
|
46 |
|
47 |
-
def search(term, num_results=
|
48 |
"""Performs a Google search and returns the results."""
|
49 |
escaped_term = urllib.parse.quote_plus(term)
|
50 |
all_results = []
|
@@ -74,7 +74,6 @@ def search(term, num_results=3, timeout=5, ssl_verify=None):
|
|
74 |
visible_text = extract_text_from_webpage(webpage.text)
|
75 |
all_results.append({"link": link, "text": visible_text})
|
76 |
except requests.exceptions.RequestException as e:
|
77 |
-
# Handle errors fetching or processing webpage
|
78 |
print(f"Error fetching or processing {link}: {e}")
|
79 |
all_results.append({"link": link, "text": None})
|
80 |
else:
|
|
|
44 |
visible_text = soup.get_text(strip=True)
|
45 |
return visible_text
|
46 |
|
47 |
+
def search(term, num_results=2, timeout=5, ssl_verify=None):
|
48 |
"""Performs a Google search and returns the results."""
|
49 |
escaped_term = urllib.parse.quote_plus(term)
|
50 |
all_results = []
|
|
|
74 |
visible_text = extract_text_from_webpage(webpage.text)
|
75 |
all_results.append({"link": link, "text": visible_text})
|
76 |
except requests.exceptions.RequestException as e:
|
|
|
77 |
print(f"Error fetching or processing {link}: {e}")
|
78 |
all_results.append({"link": link, "text": None})
|
79 |
else:
|