Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,12 @@ def duckduckgo(search_term):
|
|
70 |
try:
|
71 |
response = requests.get(url)
|
72 |
response.raise_for_status() # Raises HTTPError for bad responses
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
74 |
except requests.exceptions.RequestException as e:
|
75 |
print(f"An error occurred: {e}")
|
76 |
return response.text
|
|
|
70 |
try:
|
71 |
response = requests.get(url)
|
72 |
response.raise_for_status() # Raises HTTPError for bad responses
|
73 |
+
s1 = response.text
|
74 |
+
# Removing HTML tags using Beautiful Soup
|
75 |
+
soup = BeautifulSoup(s1, "html.parser")
|
76 |
+
s2 = soup.get_text()
|
77 |
+
return s2
|
78 |
+
#return response.text # Return the content of the response
|
79 |
except requests.exceptions.RequestException as e:
|
80 |
print(f"An error occurred: {e}")
|
81 |
return response.text
|