From 00d7dd70fc741745a392e2d76716aab897c5ceb1 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sat, 9 May 2026 05:02:18 +0000 Subject: [PATCH] fix(source_health): paywall-Strategie nicht ueber removepaywall fuer Feed-URL removepaywall.com liefert HTML (Article-Renderer), nicht XML - der Feed-Validity-Check schlug daher fehl mit "Kein gueltiger RSS/Atom-Feed". Korrektur: - paywall: Feed-URL direkt mit Browser-UA laden (kein URL-Rewrite). - Bei paywall + 4xx: status=warning (erwartbar), Feed-Validity skippen. - removepaywall.com bleibt im Researcher-Prompt fuer Article-Inhalte (das ist der korrekte Use-Case). --- src/services/source_health.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/source_health.py b/src/services/source_health.py index ed1242c..6cc0e10 100644 --- a/src/services/source_health.py +++ b/src/services/source_health.py @@ -143,18 +143,28 @@ async def _check_source_reachability( if url and not url.startswith(("http://", "https://")): url = "https://" + url.lstrip("/") - # Initialen UA waehlen: googlebot direkt; paywall ueber removepaywalls; default normal + # Initialen UA waehlen initial_ua = HEALTH_CHECK_USER_AGENT initial_url = url if strategy == "googlebot": initial_ua = USER_AGENT_GOOGLEBOT elif strategy == "paywall": - initial_url = REMOVEPAYWALLS_PREFIX + url + # Paywall-Quellen: Feed-URL direkt laden, aber mit Browser-UA (versucht Bot-Detection zu umgehen). + # removepaywall.com ist fuer Article-URLs, NICHT fuer RSS-Feed-Validity-Checks + # (gibt HTML statt XML zurueck). Researcher-Pipeline nutzt removepaywall fuer Inhalte. initial_ua = USER_AGENT_BROWSER try: resp = await client.get(initial_url, headers={"User-Agent": initial_ua}) + # Paywall-Quellen: 4xx ist erwartbar (Bot-Detection), als warning markieren statt error + if strategy == "paywall" and resp.status_code in RETRY_ON_STATUS: + checks.append({ + "type": "reachability", "status": "warning", + "message": f"Paywall-Quelle, Direkt-Zugang HTTP {resp.status_code} (Researcher-Pipeline nutzt removepaywall.com fuer Inhalte)", + }) + return checks # Feed-Validity-Check skippen (Paywall liefert kein RSS) + # Bot-Block-Retry nur bei strategy='default' if ( strategy == "default" @@ -167,7 +177,6 @@ async def _check_source_reachability( "type": "reachability", "status": "warning", "message": f"Erreichbar nur mit Googlebot-UA (Standard-UA bekam HTTP {initial_url and 'unknown' or 'XXX'})", }) - # Hinweis-Eintrag, aber Hauptcheck folgt unten als 'ok' weil resp jetzt die Retry-Antwort ist if resp.status_code >= 400: checks.append({