Skip to content

Withdrawn - #2849

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

Withdrawn#2849
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 24, 2026

Copy link
Copy Markdown

No description provided.

Two bugs made the FlareSolverr backend unable to serve any scraper that
fetches a JSON endpoint, so sites behind a Cloudflare managed challenge had
no working fallback at all.

1. `params` was silently dropped. FlareSolverr's API has no `params` field
   and `FlareSolverrBackend.request` only forwarded `json`/`data`, and only
   for POST. A `scraper.get(url, params={...})` therefore reached the site
   with no query string. Fold them into the URL instead, before the URL is
   logged so the request line shows what was actually fetched.

2. The response body was the rendered DOM, not the raw payload. Chrome shows
   non-HTML documents in its built-in viewer, so FlareSolverr returns
   `<html><head>..</head><body><pre>{json}</pre>..</html>` and any caller
   doing `.json()` gets a JSONDecodeError. Unwrap that shell, matching the
   whole document so a real page containing a `<pre>` is left untouched, and
   unescape the entities Chrome introduces in the text node.

Verified against Babepedia, which is currently behind a managed challenge:
`performer-by-name` went from `JSONDecodeError` (and, once that was fixed, an
empty list from the dropped `params`) to returning correct search results.
`performer-by-url` and other HTML scrapes are byte-for-byte unaffected.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ghost ghost closed this Aug 24, 2026
@ghost
ghost deleted the fix/flaresolverr-params-and-json branch August 24, 2026 23:45
@ghost ghost changed the title fix(py_common): make the FlareSolverr backend usable for JSON endpoints Withdrawn Aug 24, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants