fix: update overseas news API url and key mapping
This commit is contained in:
@@ -80,7 +80,7 @@ def fetch_overseas_news() -> List[Dict[str, str]]:
|
|||||||
"""
|
"""
|
||||||
네이버 금융 해외증시 뉴스 크롤링 (모바일 API 사용)
|
네이버 금융 해외증시 뉴스 크롤링 (모바일 API 사용)
|
||||||
"""
|
"""
|
||||||
api_url = "https://m.stock.naver.com/api/news/list/global?pageSize=20&page=1"
|
api_url = "https://api.stock.naver.com/news/overseas/category/breaking?pageSize=20&page=1"
|
||||||
try:
|
try:
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)"
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||||
@@ -96,9 +96,10 @@ def fetch_overseas_news() -> List[Dict[str, str]]:
|
|||||||
|
|
||||||
articles = []
|
articles = []
|
||||||
for item in items:
|
for item in items:
|
||||||
title = item.get("subject", "")
|
# API 키 매핑 (subject/title/tit, summary/subContent/sub_tit 등)
|
||||||
summary = item.get("summary", "")
|
title = item.get("subject") or item.get("title") or item.get("tit") or ""
|
||||||
press = item.get("officeName", "")
|
summary = item.get("summary") or item.get("subContent") or item.get("sub_tit") or ""
|
||||||
|
press = item.get("officeName") or item.get("office_name") or item.get("cp_name") or ""
|
||||||
|
|
||||||
# 날짜 포맷팅 (20260126123000 -> 2026-01-26 12:30:00)
|
# 날짜 포맷팅 (20260126123000 -> 2026-01-26 12:30:00)
|
||||||
raw_dt = str(item.get("dt", ""))
|
raw_dt = str(item.get("dt", ""))
|
||||||
|
|||||||
Reference in New Issue
Block a user