Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -33,15 +33,13 @@ def get_impressum_text(search_term):
|
|
33 |
if 'items' in search_results:
|
34 |
for item in search_results['items']:
|
35 |
link = item['link']
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
impressum_div = soup.find('div', class_='MjjYud')
|
41 |
-
|
42 |
-
return impressum_div.text.strip()
|
43 |
|
|
|
44 |
|
|
|
45 |
|
46 |
def websearch(prompt):
|
47 |
|
|
|
33 |
if 'items' in search_results:
|
34 |
for item in search_results['items']:
|
35 |
link = item['link']
|
36 |
+
response = requests.get(link, timeout=5) # Timeout hinzugefügt für Fehlerbehandlung
|
37 |
+
response.raise_for_status() # Wirft eine Exception, wenn der Statuscode nicht 200 ist
|
38 |
+
soup = BeautifulSoup(response.content, 'html.parser')
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
impressum_div = soup.find('div', class_='MjjYud')
|
41 |
|
42 |
+
return impressum_div.text.strip()
|
43 |
|
44 |
def websearch(prompt):
|
45 |
|