File size: 570 Bytes
e7120e9
 
 
 
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
import requests
from bs4 import BeautifulSoup
import streamlit as st

def scrape_wikipedia(url):
    response = requests.get(url)
    soup = BeautifulSoup(response.content, 'html.parser')
    articles_list = soup.find('div', {'class': 'div-col columns column-width'}).find_all('li')
    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()