Spaces:
Runtime error
Runtime error
import requests | |
from bs4 import BeautifulSoup | |
import streamlit as st | |
# Define the URL of the Wikipedia page to scrape | |
url = 'https://en.wikipedia.org/wiki/Health_care' | |
# Send an HTTP request to the URL and get the HTML response | |
response = requests.get(url) | |
# Parse the HTML content using Beautiful Soup | |
soup = BeautifulSoup(response.content, 'html.parser') | |
# Find the list of articles on the page | |
articles_list = soup.find('div', {'class': 'div-col columns column-width'}).find_all('li') | |
# Display the list of articles in Streamlit | |
st.write("List of articles on health care:") | |
for article in articles_list: | |
st.write(article.text) | |