Spaces:
Runtime error
Runtime error
Update i_search.py
Browse files- i_search.py +4 -1
i_search.py
CHANGED
|
@@ -16,7 +16,10 @@ def i_search(url):
|
|
| 16 |
try:
|
| 17 |
response.raise_for_status()
|
| 18 |
soup = BeautifulSoup(response.content, 'html.parser')
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
except Exception as e:
|
| 21 |
print (e)
|
| 22 |
return "An Error occured when fetching this website. Please check the URL and try again, or use a different URL"
|
|
|
|
| 16 |
try:
|
| 17 |
response.raise_for_status()
|
| 18 |
soup = BeautifulSoup(response.content, 'html.parser')
|
| 19 |
+
out = ' '.join([p.text for p in soup.find_all('p')])
|
| 20 |
+
if out == "" or out == None:
|
| 21 |
+
out = ' '.join([p.text for p in soup.find_all('article')])
|
| 22 |
+
return out
|
| 23 |
except Exception as e:
|
| 24 |
print (e)
|
| 25 |
return "An Error occured when fetching this website. Please check the URL and try again, or use a different URL"
|