Spaces:
Runtime error
Runtime error
File size: 673 Bytes
e7120e9 b4e1b44 59ddf59 b4e1b44 e7120e9 b4e1b44 e7120e9 b4e1b44 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import requests
from bs4 import BeautifulSoup
import streamlit as st
def scrape_wikipedia(url):
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
div_element = soup.find('div', {'class': 'div-col columns column-width'})
if div_element is not None:
articles_list = div_element.find_all('li')
else:
articles_list = []
return articles_list
def main():
url = 'https://en.wikipedia.org/wiki/Health_care'
articles_list = scrape_wikipedia(url)
st.write("List of articles on health care:")
for article in articles_list:
st.write(article.text)
if __name__ == '__main__':
main()
|