Update app.py
Browse files
app.py
CHANGED
|
@@ -1287,14 +1287,13 @@ class AdvancedAIAnalyzer:
|
|
| 1287 |
"""AI Times์์ ์ค๋ ๋ ์ง ๋ด์ค ํฌ๋กค๋ง"""
|
| 1288 |
print("๐ฐ AI Times ๋ด์ค ์์ง ์ค...")
|
| 1289 |
|
| 1290 |
-
# ์์งํ URL ๋ชฉ๋ก
|
| 1291 |
urls = [
|
| 1292 |
'https://www.aitimes.com/news/articleList.html?sc_multi_code=S2&view_type=sm',
|
| 1293 |
'https://www.aitimes.com/news/articleList.html?sc_section_code=S1N24&view_type=sm'
|
| 1294 |
]
|
| 1295 |
|
| 1296 |
all_news = []
|
| 1297 |
-
today = datetime.now().strftime('%m-%d')
|
| 1298 |
|
| 1299 |
for url_idx, url in enumerate(urls, 1):
|
| 1300 |
try:
|
|
@@ -1307,14 +1306,8 @@ class AdvancedAIAnalyzer:
|
|
| 1307 |
|
| 1308 |
text = response.text
|
| 1309 |
|
| 1310 |
-
#
|
| 1311 |
-
# ์: [MS "๊ธ์ฆํ๋ '์ฑGPT' ์์๋ก ๋ฐ์ดํฐ์ผํฐ ๋ถ์กฑ...2026๋
๊น์ง ์ง์๋ ๋ฏ"](https://www.aitimes.com/news/articleView.html?idxno=203055)
|
| 1312 |
-
# ...
|
| 1313 |
-
# ์ฐ์
์ผ๋ฐ๋ฐ์ฐฌ ๊ธฐ์10-10 15:10
|
| 1314 |
-
|
| 1315 |
-
# ์ ๋ชฉ๊ณผ ๋งํฌ ๋งค์นญ ํจํด
|
| 1316 |
pattern = r'\[([^\]]+)\]\((https://www\.aitimes\.com/news/articleView\.html\?idxno=\d+)\)'
|
| 1317 |
-
|
| 1318 |
matches = re.finditer(pattern, text)
|
| 1319 |
|
| 1320 |
articles_found = 0
|
|
@@ -1323,15 +1316,12 @@ class AdvancedAIAnalyzer:
|
|
| 1323 |
title = match.group(1).strip()
|
| 1324 |
link = match.group(2).strip()
|
| 1325 |
|
| 1326 |
-
# ์ ๋ชฉ์ด ๋๋ฌด ์งง์ผ๋ฉด ์คํต
|
| 1327 |
if len(title) < 10:
|
| 1328 |
continue
|
| 1329 |
|
| 1330 |
-
#
|
| 1331 |
pos = match.end()
|
| 1332 |
nearby_text = text[pos:pos+200]
|
| 1333 |
-
|
| 1334 |
-
# ๋ ์ง ํจํด: 10-10 15:10 ํ์
|
| 1335 |
date_pattern = r'(\d{2}-\d{2}\s+\d{2}:\d{2})'
|
| 1336 |
date_match = re.search(date_pattern, nearby_text)
|
| 1337 |
|
|
@@ -1351,20 +1341,19 @@ class AdvancedAIAnalyzer:
|
|
| 1351 |
|
| 1352 |
all_news.append(news_item)
|
| 1353 |
articles_found += 1
|
| 1354 |
-
|
| 1355 |
print(f" โ ์ถ๊ฐ: {title[:60]}... ({date_text})")
|
| 1356 |
|
| 1357 |
except Exception as e:
|
| 1358 |
continue
|
| 1359 |
|
| 1360 |
print(f" โ {articles_found}๊ฐ ์ค๋์ ๊ธฐ์ฌ ๋ฐ๊ฒฌ\n")
|
| 1361 |
-
time.sleep(1)
|
| 1362 |
|
| 1363 |
except Exception as e:
|
| 1364 |
print(f" โ ๏ธ URL ์์ง ์ค๋ฅ: {e}\n")
|
| 1365 |
continue
|
| 1366 |
|
| 1367 |
-
# ์ค๋ณต ์ ๊ฑฐ
|
| 1368 |
unique_news = []
|
| 1369 |
seen_urls = set()
|
| 1370 |
for news in all_news:
|
|
@@ -1374,7 +1363,7 @@ class AdvancedAIAnalyzer:
|
|
| 1374 |
|
| 1375 |
print(f"โ
์ด {len(unique_news)}๊ฐ ์ค๋ณต ์ ๊ฑฐ๋ ์ค๋์ ๋ด์ค\n")
|
| 1376 |
|
| 1377 |
-
# ์ต์ 3
|
| 1378 |
if len(unique_news) < 3:
|
| 1379 |
print("โ ๏ธ ๋ด์ค๊ฐ ๋ถ์กฑํ์ฌ ์ต๊ทผ ์ํ ์ถ๊ฐ\n")
|
| 1380 |
sample_news = [
|
|
@@ -1404,7 +1393,7 @@ class AdvancedAIAnalyzer:
|
|
| 1404 |
if sample['url'] not in seen_urls:
|
| 1405 |
unique_news.append(sample)
|
| 1406 |
|
| 1407 |
-
return unique_news[:20]
|
| 1408 |
|
| 1409 |
def fetch_huggingface_models(self, limit: int = 30) -> List[Dict]:
|
| 1410 |
"""ํ๊น
ํ์ด์ค ํธ๋ ๋ฉ ๋ชจ๋ธ 30๊ฐ ์์ง (์ค์ API)"""
|
|
|
|
| 1287 |
"""AI Times์์ ์ค๋ ๋ ์ง ๋ด์ค ํฌ๋กค๋ง"""
|
| 1288 |
print("๐ฐ AI Times ๋ด์ค ์์ง ์ค...")
|
| 1289 |
|
|
|
|
| 1290 |
urls = [
|
| 1291 |
'https://www.aitimes.com/news/articleList.html?sc_multi_code=S2&view_type=sm',
|
| 1292 |
'https://www.aitimes.com/news/articleList.html?sc_section_code=S1N24&view_type=sm'
|
| 1293 |
]
|
| 1294 |
|
| 1295 |
all_news = []
|
| 1296 |
+
today = datetime.now().strftime('%m-%d')
|
| 1297 |
|
| 1298 |
for url_idx, url in enumerate(urls, 1):
|
| 1299 |
try:
|
|
|
|
| 1306 |
|
| 1307 |
text = response.text
|
| 1308 |
|
| 1309 |
+
# ์ ๊ทํํ์์ผ๋ก [์ ๋ชฉ](๋งํฌ) ํจํด ์ถ์ถ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1310 |
pattern = r'\[([^\]]+)\]\((https://www\.aitimes\.com/news/articleView\.html\?idxno=\d+)\)'
|
|
|
|
| 1311 |
matches = re.finditer(pattern, text)
|
| 1312 |
|
| 1313 |
articles_found = 0
|
|
|
|
| 1316 |
title = match.group(1).strip()
|
| 1317 |
link = match.group(2).strip()
|
| 1318 |
|
|
|
|
| 1319 |
if len(title) < 10:
|
| 1320 |
continue
|
| 1321 |
|
| 1322 |
+
# ๋ ์ง ์ฐพ๊ธฐ (๋งํฌ ๋ค 200์ ์ด๋ด)
|
| 1323 |
pos = match.end()
|
| 1324 |
nearby_text = text[pos:pos+200]
|
|
|
|
|
|
|
| 1325 |
date_pattern = r'(\d{2}-\d{2}\s+\d{2}:\d{2})'
|
| 1326 |
date_match = re.search(date_pattern, nearby_text)
|
| 1327 |
|
|
|
|
| 1341 |
|
| 1342 |
all_news.append(news_item)
|
| 1343 |
articles_found += 1
|
|
|
|
| 1344 |
print(f" โ ์ถ๊ฐ: {title[:60]}... ({date_text})")
|
| 1345 |
|
| 1346 |
except Exception as e:
|
| 1347 |
continue
|
| 1348 |
|
| 1349 |
print(f" โ {articles_found}๊ฐ ์ค๋์ ๊ธฐ์ฌ ๋ฐ๊ฒฌ\n")
|
| 1350 |
+
time.sleep(1)
|
| 1351 |
|
| 1352 |
except Exception as e:
|
| 1353 |
print(f" โ ๏ธ URL ์์ง ์ค๋ฅ: {e}\n")
|
| 1354 |
continue
|
| 1355 |
|
| 1356 |
+
# ์ค๋ณต ์ ๊ฑฐ
|
| 1357 |
unique_news = []
|
| 1358 |
seen_urls = set()
|
| 1359 |
for news in all_news:
|
|
|
|
| 1363 |
|
| 1364 |
print(f"โ
์ด {len(unique_news)}๊ฐ ์ค๋ณต ์ ๊ฑฐ๋ ์ค๋์ ๋ด์ค\n")
|
| 1365 |
|
| 1366 |
+
# ์ต์ 3๊ฐ ๋ณด์ฅ
|
| 1367 |
if len(unique_news) < 3:
|
| 1368 |
print("โ ๏ธ ๋ด์ค๊ฐ ๋ถ์กฑํ์ฌ ์ต๊ทผ ์ํ ์ถ๊ฐ\n")
|
| 1369 |
sample_news = [
|
|
|
|
| 1393 |
if sample['url'] not in seen_urls:
|
| 1394 |
unique_news.append(sample)
|
| 1395 |
|
| 1396 |
+
return unique_news[:20]
|
| 1397 |
|
| 1398 |
def fetch_huggingface_models(self, limit: int = 30) -> List[Dict]:
|
| 1399 |
"""ํ๊น
ํ์ด์ค ํธ๋ ๋ฉ ๋ชจ๋ธ 30๊ฐ ์์ง (์ค์ API)"""
|