Add SearXNG news collector merged into the briefing pipeline

Optional meta-search source (SEARXNG_BASE_URL): per-query isolation,
time_range=day, merged and deduplicated with the RSS feeds. Briefings
still publish on RSS alone if the instance is down.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jsahn
2026-09-01 00:58:35 +09:00
co-authored by Claude Fable 5
parent 8bc43b3ce4
commit 920d9358a0
7 changed files with 383 additions and 14 deletions
+16 -1
View File
@@ -16,8 +16,9 @@ from pydantic import BaseModel
from us2kr.collectors.base import run_safely
from us2kr.collectors.events import fetch_earnings, fetch_events
from us2kr.collectors.news import fetch_news
from us2kr.collectors.news import dedup_news, fetch_news
from us2kr.collectors.prices import fetch_quotes
from us2kr.collectors.searx import fetch_searx_news
from us2kr.config import KST, Settings
from us2kr.deliver import build_deliverers
from us2kr.llm.base import LLMError
@@ -79,6 +80,20 @@ def build_payload(session: date, settings: Settings, clock: MarketClock, store:
news = run_safely(
"news", lambda: fetch_news(since=news_since, max_items=settings.news_max_items), [], gaps
)
if settings.searxng_base_url:
searx_news = run_safely(
"searxng",
lambda: fetch_searx_news(
settings.searxng_base_url, # type: ignore[arg-type]
since=news_since,
queries=settings.searxng_queries or None,
),
[],
gaps,
)
if searx_news:
# RSS first so it wins timestamp ties in dedup; cap stays at news_max_items overall.
news = dedup_news([*news, *searx_news])[: settings.news_max_items]
events = run_safely("events", lambda: fetch_events(session, settings.fred_api_key), [], gaps)
tickers = earnings_tickers()
earnings = run_safely("earnings", lambda: fetch_earnings(session, tickers), [], gaps)