From 6a44b10a3bbcb78fd7e5d33c7b9a1cb575bcd904 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Thu, 26 Mar 2026 14:03:39 +0900 Subject: [PATCH] =?UTF-8?q?fix(law=5Fmonitor):=20JP/EU=20RSS=20URL=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=E2=80=94=20news.rdf=20+=20rss.xml,=20RDF?= =?UTF-8?q?=20=EB=84=A4=EC=9E=84=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/law_monitor.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/law_monitor.py b/scripts/law_monitor.py index e1de021..5f9bdee 100644 --- a/scripts/law_monitor.py +++ b/scripts/law_monitor.py @@ -303,16 +303,19 @@ def fetch_jp_mhlw(last_check: dict) -> int: logger.info("=== JP 厚生労働省 확인 ===") try: import xml.etree.ElementTree as ET - resp = requests.get("https://www.mhlw.go.jp/stf/rss/shinchaku.xml", timeout=30) + resp = requests.get("https://www.mhlw.go.jp/stf/news.rdf", timeout=30) resp.raise_for_status() root = ET.fromstring(resp.content) safety_keywords = ["労働安全", "安全衛生", "労災", "化学物質", "石綿", "安全管理"] + ns = {"rss": "http://purl.org/rss/1.0", "dc": "http://purl.org/dc/elements/1.1/"} count = 0 - for item in root.iter("item"): - title = item.findtext("title", "") - link = item.findtext("link", "") + # RDF 1.0 형식: 또는 {ns}item + items = root.findall("rss:item", ns) or root.iter("item") + for item in items: + title = item.findtext("rss:title", "", ns) or item.findtext("title", "") + link = item.findtext("rss:link", "", ns) or item.findtext("link", "") pub_date = item.findtext("pubDate", "") # 안전위생 키워드 필터 @@ -366,7 +369,7 @@ def fetch_eu_osha(last_check: dict) -> int: logger.info("=== EU-OSHA 확인 ===") try: import xml.etree.ElementTree as ET - resp = requests.get("https://osha.europa.eu/en/rss", timeout=30) + resp = requests.get("https://osha.europa.eu/en/rss.xml", timeout=30) resp.raise_for_status() root = ET.fromstring(resp.content)