Respect Fed release dates and policy document layouts
Development CI / check-and-build (push) Successful in 2m12s
GitHub Git mirror / mirror (push) Successful in 7s
Development CI / deploy-development (push) Successful in 2m31s

Filter discovery links against both realtime and historical date boundaries, keep date-only cutoff days, and use the official calendar release date for FOMC minutes. Parse implementation note and projection headings and replay real Fed discovery and policy bodies without external I/O.
This commit is contained in:
eezd committed 2026-11-04 22:39:56 +08:00
1 parent cd7a314503
commit 328f1e91a1
5 files changed
+128 -10

No files matched your search

+6 -2
View File
@@ -105,11 +105,11 @@ def validate_body(content: str) -> None:
raise ValueError('官方正文为空或过短')
def article(source: str, html: str, url: str) -> dict:
def article(source: str, html: str, url: str, *, release_date: str | None = None) -> dict:
sel = Selector(html)
validate_body(html)
selectors = {
'fed': ('#article h3.title', '#article h3', '#article h2'),
'fed': ('#article h3.title', '#article h3', '#article h2', '#content .heading h3', '#content .col-xs-12.col-sm-8.col-md-8 h3'),
'treasury': ('h2.uswds-page-title',),
'cftc': ('article h1:not(.press-release-title)',),
}.get(source, ('.main-content__main h1', '#main_content h1', 'main h1', 'h1'))
@@ -133,6 +133,10 @@ def article(source: str, html: str, url: str) -> dict:
values.insert(0, '-'.join(m.groups()))
if source == 'ofac' and (m := re.search(r'/recent-actions/(\d{4})(\d{2})(\d{2})', url)):
values.insert(0, '-'.join(m.groups()))
if source == 'fed' and '/monetarypolicy/fomcminutes' in url:
if release_date is None:
raise ValueError('FOMC 纪要缺少官方日历发布日期')
values = [release_date]
at = precision = None
for value in values:
try: