Spaces:
Sleeping
Sleeping
Update i_search.py
Browse files- i_search.py +7 -3
i_search.py
CHANGED
@@ -13,9 +13,13 @@ headers_Get = {
|
|
13 |
|
14 |
def i_search(url):
|
15 |
response = requests.get(url)
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
|
|
|
13 |
|
14 |
def i_search(url):
|
15 |
response = requests.get(url)
|
16 |
+
try:
|
17 |
+
response.raise_for_status()
|
18 |
+
soup = BeautifulSoup(response.content, 'html.parser')
|
19 |
+
return ' '.join([p.text for p in soup.find_all('p')])
|
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"
|
23 |
|
24 |
|
25 |
|