CSB261 commited on
Commit
7ff16ac
1 Parent(s): 1d97df2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -17,7 +17,10 @@ for news_item in soup.select('div.rankingnews_box ul.rankingnews_list li'):
17
  title = news_item.find('a', class_='list_title').text.strip()
18
  link = news_item.find('a', class_='list_title')['href']
19
  time = news_item.find('span', class_='list_time').text.strip()
20
- image_url = news_item.find('img')['src']
 
 
 
21
 
22
  news_list.append({
23
  'Rank': rank,
 
17
  title = news_item.find('a', class_='list_title').text.strip()
18
  link = news_item.find('a', class_='list_title')['href']
19
  time = news_item.find('span', class_='list_time').text.strip()
20
+
21
+ # 이미지가 있는지 확인
22
+ img_tag = news_item.find('img')
23
+ image_url = img_tag['src'] if img_tag else 'No Image Available'
24
 
25
  news_list.append({
26
  'Rank': rank,