Skip to content

Fix MSU (Mid Suffolk) scraper - #488

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

Fix MSU (Mid Suffolk) scraper#488
symroe wants to merge 1 commit into
masterfrom
fix/MSU-scraper

Conversation

@symroe

@symroe symroe commented Aug 4, 2026

Copy link
Copy Markdown
Member

What broke

The scraper was requesting http://baberghmidsuffolk.moderngov.co.uk/mgWebService.asmx/GetCouncillorsByWard and receiving a 403. The Babergh and Mid Suffolk shared ModernGov instance is now behind Cloudflare, which blocks the HTTP endpoint entirely and serves a Cloudflare challenge page on HTTPS when accessed with a non-browser TLS fingerprint. Same failure pattern as BNS, BRW, CHI, CHS, HAS, HAT, MSS and other recently affected ModernGov councils.

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 (the existing email-domain filter get_single_councillor is preserved)

Scrape results

Cloudflare blocks all non-Chromium clients from this environment, so exact counts require a Lambda run.

Metric Count
Councillors found TBC (Lambda run needed)
With email address TBC (filtered to midsuffolk.gov.uk addresses)
With photo TBC

Generated by Claude Code

…bypass

The scraper was hitting http://baberghmidsuffolk.moderngov.co.uk which returned 403.
Mid Suffolk'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 85d10eb

Initial fix: HTTPS migration + Playwright for Cloudflare bypass.

Cloudflare blocks all non-Chromium clients from this environment, so scrape counts can only be confirmed after a Lambda run.

Metric Count
Councillors found TBC (Lambda run needed)
With email address TBC (filtered to midsuffolk.gov.uk addresses)
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