Repository navigation
Conversation
Contributor
Author
|
Maybe this should be done for HTML scraping as well... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Images on Stack Exchange (
i.sstatic.net) are now behind a Cloudflare challenge, so/proxyreceived the "Just a moment..." page instead of the image and the browser showed broken images. This happens with the API scraper as well.This adds optional support for FlareSolverr to the image proxy:
FLARESOLVERR_URLis set, the proxy asks FlareSolverr to solve the challenge once and keeps the resulting cookies and user agent per host. Later image requests reuse them, so FlareSolverr is called again only when the clearance stops working.Without
FLARESOLVERR_URL, nothing changes except the 502.Testing: ran an instance with
SCRAPER=apifor about 2 hours, loading a question with images every 5 minutes. 118 of 119 images loaded (the failure was a third-party host with an invalid TLS certificate). The only solves happened on startup, and the clearance cookie was still valid after 112 minutes. A solve takes about 2–3s; cached image requests had a median of 0.42s. Unit tests cover shared solves and per-host clearance.