Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,17 +13,24 @@ soup = BeautifulSoup(response.content, 'html.parser')
|
|
13 |
news_list = []
|
14 |
|
15 |
for news_item in soup.select('div.rankingnews_box ul.rankingnews_list li'):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# ์ด๋ฏธ์ง ํ๊ทธ์ src ์์ฑ ํ์ธ
|
22 |
img_tag = news_item.find('img')
|
23 |
-
if img_tag and 'src' in img_tag.attrs
|
24 |
-
image_url = img_tag['src']
|
25 |
-
else:
|
26 |
-
image_url = 'No Image Available'
|
27 |
|
28 |
news_list.append({
|
29 |
'Rank': rank,
|
|
|
13 |
news_list = []
|
14 |
|
15 |
for news_item in soup.select('div.rankingnews_box ul.rankingnews_list li'):
|
16 |
+
# ์์ ๋ฒํธ๊ฐ ์กด์ฌํ๋์ง ํ์ธ
|
17 |
+
rank_tag = news_item.find('em', class_='list_ranking_num')
|
18 |
+
rank = rank_tag.text if rank_tag else 'No Rank'
|
19 |
+
|
20 |
+
# ์ ๋ชฉ์ด ์กด์ฌํ๋์ง ํ์ธ
|
21 |
+
title_tag = news_item.find('a', class_='list_title')
|
22 |
+
title = title_tag.text.strip() if title_tag else 'No Title'
|
23 |
+
|
24 |
+
# ๋งํฌ๊ฐ ์กด์ฌํ๋์ง ํ์ธ
|
25 |
+
link = title_tag['href'] if title_tag else '#'
|
26 |
+
|
27 |
+
# ์๊ฐ ์ ๋ณด๊ฐ ์กด์ฌํ๋์ง ํ์ธ
|
28 |
+
time_tag = news_item.find('span', class_='list_time')
|
29 |
+
time = time_tag.text.strip() if time_tag else 'No Time'
|
30 |
|
31 |
# ์ด๋ฏธ์ง ํ๊ทธ์ src ์์ฑ ํ์ธ
|
32 |
img_tag = news_item.find('img')
|
33 |
+
image_url = img_tag['src'] if img_tag and 'src' in img_tag.attrs else 'No Image Available'
|
|
|
|
|
|
|
34 |
|
35 |
news_list.append({
|
36 |
'Rank': rank,
|