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).
Dieser Commit ist enthalten in:
@@ -143,18 +143,28 @@ async def _check_source_reachability(
|
|||||||
if url and not url.startswith(("http://", "https://")):
|
if url and not url.startswith(("http://", "https://")):
|
||||||
url = "https://" + url.lstrip("/")
|
url = "https://" + url.lstrip("/")
|
||||||
|
|
||||||
# Initialen UA waehlen: googlebot direkt; paywall ueber removepaywalls; default normal
|
# Initialen UA waehlen
|
||||||
initial_ua = HEALTH_CHECK_USER_AGENT
|
initial_ua = HEALTH_CHECK_USER_AGENT
|
||||||
initial_url = url
|
initial_url = url
|
||||||
if strategy == "googlebot":
|
if strategy == "googlebot":
|
||||||
initial_ua = USER_AGENT_GOOGLEBOT
|
initial_ua = USER_AGENT_GOOGLEBOT
|
||||||
elif strategy == "paywall":
|
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
|
initial_ua = USER_AGENT_BROWSER
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = await client.get(initial_url, headers={"User-Agent": initial_ua})
|
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'
|
# Bot-Block-Retry nur bei strategy='default'
|
||||||
if (
|
if (
|
||||||
strategy == "default"
|
strategy == "default"
|
||||||
@@ -167,7 +177,6 @@ async def _check_source_reachability(
|
|||||||
"type": "reachability", "status": "warning",
|
"type": "reachability", "status": "warning",
|
||||||
"message": f"Erreichbar nur mit Googlebot-UA (Standard-UA bekam HTTP {initial_url and 'unknown' or 'XXX'})",
|
"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:
|
if resp.status_code >= 400:
|
||||||
checks.append({
|
checks.append({
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren