Skip to content

Fix CHS (Chesterfield) scraper - #484

Open
symroe wants to merge 1 commit into
masterfrom
fix/CHS-scraper
Open

Fix CHS (Chesterfield) scraper#484
symroe wants to merge 1 commit into
masterfrom
fix/CHS-scraper

Conversation

@symroe

@symroe symroe commented Aug 4, 2026

Copy link
Copy Markdown
Member

What broke

The scraper was requesting http://chesterfield.moderngov.co.uk/mgWebService.asmx/GetCouncillorsByWard and receiving a 403. Chesterfield's ModernGov instance is now behind Cloudflare, which blocks the HTTP endpoint entirely and serves a 403 Cloudflare challenge page even on the HTTPS endpoint when accessed with a non-browser TLS fingerprint (confirmed: wreq on HTTPS returns a 4 551-byte Cloudflare HTML block page with "Attention Required! | Cloudflare" title).

What was fixed

  • metadata.json: migrated base_url from http:// to https://
  • councillors.py: added http_lib = "playwright" so headless Chromium executes the Cloudflare JS challenge before fetching the ModGov ASMX XML endpoint

Scrape results

Cloudflare blocks all non-Chromium clients from this environment, so exact counts require a Lambda run. This is the same fix pattern applied to BNS (#472), BRW (#479), CHI (#473), and other ModernGov instances recently upgraded to Cloudflare protection.

Metric Count
Councillors found TBC (Lambda run needed)
With email address TBC
With photo TBC

Generated by Claude Code

… bypass

The scraper was hitting http://chesterfield.moderngov.co.uk which returned 403.
Chesterfield's ModernGov instance is now behind Cloudflare and requires both
HTTPS and a browser-level JS challenge to access the ASMX web service endpoint.

- Migrate base_url from http:// to https://
- Add http_lib = "playwright" to execute Cloudflare JS challenge via headless Chromium
@symroe

symroe commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Re-scrape after 8295740

Initial fix: HTTPS migration + Playwright for Cloudflare bypass.

Cloudflare blocks all non-Chromium clients from this environment (both wreq and curl receive a 403 "Attention Required" challenge page), so scrape counts can only be confirmed after a Lambda run where headless Chromium will execute the JS challenge.

Metric Count
Councillors found TBC (Lambda run needed)
With email address TBC
With photo TBC

Generated by Claude Code

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.

2 participants