feat(x): X (Twitter) als Bezugsquelle pro Lage

X-Accounts werden analog zu Telegram als Quelle (source_type=x_account)
konfiguriert und pro Lage ueber include_x zugeschaltet. Der Scraper
(feeds/x_parser.py, twscrape) liest Account-Timelines, optional ueber
einen HTTP-Proxy mit Fallback auf direkten Abruf ueber die Server-IP.

- DB-Migration include_x, Pydantic-Modelle, incidents-Router
- Orchestrator-X-Pipeline plus Haiku-Account-Vorselektion
- sources-Router /x/validate, x_account-Typ in Stats und Frontend
- Lage-Einstellungen: X-Toggle neben international und Telegram
- twscrape als Abhaengigkeit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
Claude Code
2026-05-22 06:52:19 +00:00
Ursprung f1200743e6
Commit 9c50439785
12 geänderte Dateien mit 547 neuen und 10 gelöschten Zeilen

Datei anzeigen

@@ -144,6 +144,7 @@ async def get_source_stats(
"rss_feed": {"count": 0, "articles": 0},
"web_source": {"count": 0, "articles": 0},
"telegram_channel": {"count": 0, "articles": 0},
"x_account": {"count": 0, "articles": 0},
"excluded": {"count": 0, "articles": 0},
}
for row in rows:
@@ -637,6 +638,30 @@ async def validate_telegram_channel(
raise HTTPException(status_code=500, detail="Telegram-Validierung fehlgeschlagen")
@router.post("/x/validate")
async def validate_x_account(
data: dict,
current_user: dict = Depends(get_current_user),
):
"""Prueft ob ein X-Account (Twitter) erreichbar ist und gibt Account-Info zurueck."""
handle = data.get("handle", "").strip()
if not handle:
raise HTTPException(status_code=400, detail="handle ist erforderlich")
try:
from feeds.x_parser import XParser
parser = XParser()
result = await parser.validate_account(handle)
if result:
return result
raise HTTPException(status_code=404, detail="X-Account nicht erreichbar oder nicht gefunden")
except HTTPException:
raise
except Exception as e:
logger.error("X-Validierung fehlgeschlagen: %s", e, exc_info=True)
raise HTTPException(status_code=500, detail="X-Validierung fehlgeschlagen")
@router.post("/refresh-counts")
async def trigger_refresh_counts(
current_user: dict = Depends(get_current_user),