From 57f341fc2229b0816faecc3ada766c690c3fa95c Mon Sep 17 00:00:00 2001 From: ChemaVX Date: Sat, 4 Jul 2026 11:25:58 +0000 Subject: [PATCH] =?UTF-8?q?fix(scraper):=20no=20anunciar=20br=20en=20Accep?= =?UTF-8?q?t-Encoding=20=E2=80=94=20decode=20incremental=20roto=20en=20aio?= =?UTF-8?q?http=203.14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Diagnóstico definitivo: los streams br de disclosure.org/todaywhy.com son VÁLIDOS (los bytes crudos descomprimen offline con brotlicffi), pero el descompresor incremental de aiohttp 3.14.1 falla según el troceo de chunks — intermitente entre sitios e intentos, con Brotli y con brotlicffi. Sin anunciar br los servidores mandan gzip (verificado: los 4 sitios afectados, 200 + contenido íntegro) y el camino zlib es sólido. brotlicffi se queda como red por si llega br no anunciado. Co-Authored-By: Claude Fable 5 --- src/scraper/exhaustive.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scraper/exhaustive.py b/src/scraper/exhaustive.py index eb95ba8..046d641 100644 --- a/src/scraper/exhaustive.py +++ b/src/scraper/exhaustive.py @@ -27,7 +27,12 @@ HEADERS = { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.9,es;q=0.8", - "Accept-Encoding": "gzip, deflate, br", + # Sin "br": el descompresor incremental de aiohttp 3.14 falla con streams + # brotli válidos según el troceo de chunks (disclosure.org, todaywhy.com; + # los mismos bytes descomprimen bien offline con brotlicffi). Con gzip el + # camino zlib es sólido. brotlicffi queda instalado por si algún servidor + # manda br sin que se anuncie. + "Accept-Encoding": "gzip, deflate", "DNT": "1", } @@ -36,7 +41,7 @@ REDDIT_HEADERS = { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.9", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", # sin "br", ver HEADERS "Referer": "https://www.reddit.com/", "X-Requested-With": "XMLHttpRequest", }