awacke1 commited on
Commit
59ddf59
·
1 Parent(s): b4e1b44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -5,7 +5,11 @@ import streamlit as st
5
  def scrape_wikipedia(url):
6
  response = requests.get(url)
7
  soup = BeautifulSoup(response.content, 'html.parser')
8
- articles_list = soup.find('div', {'class': 'div-col columns column-width'}).find_all('li')
 
 
 
 
9
  return articles_list
10
 
11
  def main():
 
5
  def scrape_wikipedia(url):
6
  response = requests.get(url)
7
  soup = BeautifulSoup(response.content, 'html.parser')
8
+ div_element = soup.find('div', {'class': 'div-col columns column-width'})
9
+ if div_element is not None:
10
+ articles_list = div_element.find_all('li')
11
+ else:
12
+ articles_list = []
13
  return articles_list
14
 
15
  def main():