Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,16 +14,7 @@ def parse_links(ort):
|
|
14 |
|
15 |
# Parse the HTML content using BeautifulSoup
|
16 |
soup = BeautifulSoup(response.content, 'html.parser')
|
17 |
-
|
18 |
-
# Finde alle p-Tags
|
19 |
-
p_tags = soup.find_all('p')
|
20 |
|
21 |
-
# Füge den Text der p-Tags zu einem String hinzu
|
22 |
-
p_text = ' '.join(tag.get_text() for tag in p_tags)
|
23 |
-
|
24 |
-
print(p_text)
|
25 |
-
# Rückgabe als Dictionary, um es mit gr.JSON kompatibel zu machen
|
26 |
-
return p_text
|
27 |
# Den body-Tag finden
|
28 |
body_tag = soup.find('body')
|
29 |
|
@@ -32,9 +23,9 @@ def parse_links(ort):
|
|
32 |
|
33 |
# Den Text ausgeben
|
34 |
print(body_text)
|
35 |
-
|
36 |
# Rückgabe als Dictionary, um es mit gr.JSON kompatibel zu machen
|
37 |
-
return {"body_text": body_text}
|
38 |
|
39 |
except requests.RequestException as e:
|
40 |
return {"error": str(e)}
|
|
|
14 |
|
15 |
# Parse the HTML content using BeautifulSoup
|
16 |
soup = BeautifulSoup(response.content, 'html.parser')
|
|
|
|
|
|
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Den body-Tag finden
|
19 |
body_tag = soup.find('body')
|
20 |
|
|
|
23 |
|
24 |
# Den Text ausgeben
|
25 |
print(body_text)
|
26 |
+
return body_text
|
27 |
# Rückgabe als Dictionary, um es mit gr.JSON kompatibel zu machen
|
28 |
+
#return {"body_text": body_text}
|
29 |
|
30 |
except requests.RequestException as e:
|
31 |
return {"error": str(e)}
|