Fix FEN (Fenland) scraper#399
Open
symroe wants to merge 1 commit into
Open
Conversation
Fenland's ModGov endpoint (www.fenland.gov.uk/localgov/) returns a Cloudflare JS challenge (HTTP 403 "Just a moment...") when accessed from Lambda's IP range. The previous verify_requests=False fix targeted a cert issue but the underlying block is Cloudflare bot protection. Switching to http_lib="playwright" uses headless Chromium, which executes the Cloudflare JS challenge and acquires the cf_clearance cookie before fetching the ModGov XML endpoint.
Member
Author
Re-scrape after e81a97aPlaywright fix applied: replaced The endpoint (
Counts cannot be confirmed locally: the Cloudflare JS challenge cannot be bypassed without a real browser, and the Lambda environment is needed to verify end-to-end scrape results. Generated by Claude Code |
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.
What broke
Fenland's ModGov endpoint (
www.fenland.gov.uk/localgov/) is protected by Cloudflare bot detection. When accessed from Lambda using wreq's Firefox133 TLS fingerprint, the server returns HTTP 403 with a "Just a moment..." JS challenge page. The previousverify_requests = Falsefix addressed a certificate issue but does not bypass the Cloudflare JS challenge, so the scraper continues to time out in Lambda.What was fixed
verify_requests = Falsewithhttp_lib = "playwright"— headless Chromium executes the Cloudflare JS challenge and acquires thecf_clearancecookie before fetching the ModGov XML endpoint.Scrape results
Live endpoint returns a Cloudflare JS challenge from non-Chromium clients; counts will be confirmed after Lambda runs with Playwright. The endpoint serves valid ModGov XML to browser clients (confirmed via curl through proxy).
Generated by Claude Code