Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from bs4 import BeautifulSoup
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
# Define the URL of the Wikipedia page to scrape
|
6 |
+
url = 'https://en.wikipedia.org/wiki/Health_care'
|
7 |
+
|
8 |
+
# Send an HTTP request to the URL and get the HTML response
|
9 |
+
response = requests.get(url)
|
10 |
+
|
11 |
+
# Parse the HTML content using Beautiful Soup
|
12 |
+
soup = BeautifulSoup(response.content, 'html.parser')
|
13 |
+
|
14 |
+
# Find the list of articles on the page
|
15 |
+
articles_list = soup.find('div', {'class': 'div-col columns column-width'}).find_all('li')
|
16 |
+
|
17 |
+
# Display the list of articles in Streamlit
|
18 |
+
st.write("List of articles on health care:")
|
19 |
+
for article in articles_list:
|
20 |
+
st.write(article.text)
|