From 35062145ed8798d89c8700ac476493be0dbb1fd4 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Thu, 26 Mar 2026 14:52:13 +0900 Subject: [PATCH] =?UTF-8?q?fix(law=5Fmonitor):=20US=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=20=ED=95=84=ED=84=B0=20=EC=A0=9C=EA=B1=B0=20+=20JP=20RDF=20?= =?UTF-8?q?=EB=84=A4=EC=9E=84=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= 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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/law_monitor.py b/scripts/law_monitor.py index d61e945..39e5d74 100644 --- a/scripts/law_monitor.py +++ b/scripts/law_monitor.py @@ -241,7 +241,6 @@ def fetch_us_osha(last_check: dict) -> int: from_date = (datetime.now() - timedelta(days=7)).strftime("%Y-%m-%d") resp = requests.get("https://www.federalregister.gov/api/v1/documents.json", params={ "conditions[agencies][]": "occupational-safety-and-health-administration", - "conditions[type][]": ["RULE", "PRORULE"], "conditions[publication_date][gte]": from_date, "per_page": 10, "order": "newest", @@ -296,15 +295,16 @@ def fetch_jp_mhlw(last_check: dict) -> int: 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/"} + safety_keywords = ["労働安全", "安全衛生", "労災", "化学物質", "石綿", "安全管理", "労働", "安全", "衛生"] + rss_ns = "http://purl.org/rss/1.0/" count = 0 - # RDF 1.0 형식: 또는 {ns}item - items = root.findall("rss:item", ns) or root.iter("item") + # RDF 1.0 형식: {http://purl.org/rss/1.0/}item + items = root.findall(f"{{{rss_ns}}}item") + logger.info(f"JP RSS 항목: {len(items)}건") for item in items: - title = item.findtext("rss:title", "", ns) or item.findtext("title", "") - link = item.findtext("rss:link", "", ns) or item.findtext("link", "") + title = item.findtext(f"{{{rss_ns}}}title", "") + link = item.findtext(f"{{{rss_ns}}}link", "") pub_date = item.findtext("pubDate", "") # 안전위생 키워드 필터