Fix SCB (Scottish Borders) scraper - #498
Open
symroe wants to merge 1 commit into
Open
Conversation
…lare bypass The scraper was using an http:// base URL for the ModernGov endpoint. Scottish Borders' moderngov instance now requires HTTPS and is protected by a Cloudflare WAF that returns 403 to non-browser clients. Switching to https:// and using Playwright (headless Chromium) allows the JS challenge to be executed and the XML endpoint to be reached cleanly in Lambda.
Member
Author
Re-scrape after a2fc356Initial fix: HTTPS migration + Playwright for Cloudflare bypass. Cloudflare blocks all non-Chromium clients from this environment (both wreq and curl receive a connection reset or 403 challenge page), so scrape counts can only be confirmed after a Lambda run where headless Chromium will execute the JS challenge.
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
The scraper was hitting
http://scottishborders.moderngov.co.uk/mgWebService.asmx/GetCouncillorsByWardand receiving a 403. Scottish Borders' ModernGov instance now enforces HTTPS and is behind a Cloudflare WAF that challenges non-browser HTTP clients — wreq's TLS fingerprint is blocked at the WAF layer, returning 403 before the ASMX response is served.What was fixed
base_urlfromhttp://scottishborders.moderngov.co.uktohttps://scottishborders.moderngov.co.ukinmetadata.jsonhttp_lib = "playwright"to use headless Chromium in Lambda, which executes the Cloudflare JS challenge and retrieves the XML endpoint contentScrape results
Local testing is blocked by the same Cloudflare WAF from this environment. Counts will be confirmed on the next Lambda run after merge.
Generated by Claude Code