Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from bs4 import BeautifulSoup
|
|
3 |
import pandas as pd
|
4 |
import streamlit as st
|
5 |
import random
|
6 |
-
import time
|
7 |
|
8 |
# ๋ค์ด๋ฒ ๋ชจ๋ฐ์ผ ๋ด์ค ๋ญํน URL
|
9 |
url = "https://m.news.naver.com/rankingList"
|
@@ -17,7 +17,7 @@ headers = {
|
|
17 |
# ๋๋ค ๋๋ ์ด ํจ์
|
18 |
def random_delay(min_delay=1, max_delay=3):
|
19 |
delay = random.uniform(min_delay, max_delay)
|
20 |
-
time.sleep(delay)
|
21 |
|
22 |
# ์น ํ์ด์ง ์์ฒญ ๋ฐ ํ์ฑ
|
23 |
response = requests.get(url, headers=headers)
|
@@ -48,7 +48,7 @@ for news_box in soup.select('div.rankingnews_box'):
|
|
48 |
|
49 |
# ์๊ฐ ์ถ์ถ
|
50 |
time_tag = news_item.find('span', class_='list_time')
|
51 |
-
|
52 |
|
53 |
# ์ด๋ฏธ์ง URL ์ถ์ถ
|
54 |
img_tag = news_item.find('img')
|
@@ -60,7 +60,7 @@ for news_box in soup.select('div.rankingnews_box'):
|
|
60 |
'Rank': rank,
|
61 |
'Title': title,
|
62 |
'Link': link,
|
63 |
-
'Time':
|
64 |
'Image URL': image_url
|
65 |
})
|
66 |
|
|
|
3 |
import pandas as pd
|
4 |
import streamlit as st
|
5 |
import random
|
6 |
+
import time # time ๋ชจ๋์ ์ํฌํธ
|
7 |
|
8 |
# ๋ค์ด๋ฒ ๋ชจ๋ฐ์ผ ๋ด์ค ๋ญํน URL
|
9 |
url = "https://m.news.naver.com/rankingList"
|
|
|
17 |
# ๋๋ค ๋๋ ์ด ํจ์
|
18 |
def random_delay(min_delay=1, max_delay=3):
|
19 |
delay = random.uniform(min_delay, max_delay)
|
20 |
+
time.sleep(delay) # time ๋ชจ๋์ sleep ํจ์ ์ฌ์ฉ
|
21 |
|
22 |
# ์น ํ์ด์ง ์์ฒญ ๋ฐ ํ์ฑ
|
23 |
response = requests.get(url, headers=headers)
|
|
|
48 |
|
49 |
# ์๊ฐ ์ถ์ถ
|
50 |
time_tag = news_item.find('span', class_='list_time')
|
51 |
+
time_info = time_tag.text.strip() if time_tag else 'No Time'
|
52 |
|
53 |
# ์ด๋ฏธ์ง URL ์ถ์ถ
|
54 |
img_tag = news_item.find('img')
|
|
|
60 |
'Rank': rank,
|
61 |
'Title': title,
|
62 |
'Link': link,
|
63 |
+
'Time': time_info,
|
64 |
'Image URL': image_url
|
65 |
})
|
66 |
|