Skip to content

Fix ELN (East Lothian) scraper#410

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

Fix ELN (East Lothian) scraper#410
symroe wants to merge 1 commit into
masterfrom
fix/ELN-scraper

Conversation

@symroe

@symroe symroe commented Jul 2, 2026

Copy link
Copy Markdown
Member

What broke

eastlothian.gov.uk returns HTTP 403 to wreq's Firefox133 TLS fingerprint but serves the councillors page correctly to browser clients (verified: WebFetch returns valid HTML with ward accordion structure). The scraper has failed repeatedly since at least June 21 with two symptoms: explicit Status(403) errors, and list index out of range errors on days the WAF serves a challenge page instead of real HTML (the .view-id-councillors .view-content container selector finds nothing on a challenge page, leaving an empty list that then causes a parse error). The scraper passed on June 27–29 — likely due to IP rotation in Lambda — then failed again on June 30.

What was fixed

Scrape results

The WAF blocks all non-Chromium clients from this environment so a pre-merge count cannot be obtained here. Counts will be confirmed after the next Lambda run.

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

Generated by Claude Code

eastlothian.gov.uk returns HTTP 403 to wreq's Firefox133 TLS fingerprint
but serves the page correctly to browser clients (confirmed via WebFetch).
The scraper has been failing intermittently since June 21 with 403 and
'list index out of range' errors — the latter caused by the WAF returning
a challenge page instead of the councillor listing, leaving selectors with
nothing to parse.

Switching to http_lib="playwright" uses headless Chromium whose TLS
fingerprint passes the WAF, matching the fix pattern used for HAL, TON,
MON, HNS, and other councils with the same behaviour.
@symroe

symroe commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Re-scrape after 05357e5

Initial push: added http_lib = "playwright" to bypass WAF 403 on eastlothian.gov.uk.

The WAF blocks all non-Chromium HTTP clients from this environment (same block that Lambda's wreq receives), so a live scrape count cannot be obtained pre-merge. The page is confirmed to load correctly in a browser client (valid LocalGov Drupal councillor listing with ward accordions, .card divs, name/ward/party/email/image fields present).

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

Counts will be updated here after the next Lambda run confirms the fix.


Generated by Claude Code

symroe added a commit that referenced this pull request Jul 4, 2026
fife.gov.uk returns HTTP 403 to wreq's Firefox133 TLS fingerprint but
serves the councillors page correctly to browser clients. The WAF drops
the connection when it detects the non-browser TLS client-hello. This is
the same WAF fingerprint block pattern seen on ELN (PR #410), HAL (#400),
TON (#402), and others.

Adding http_lib = "playwright" switches from wreq to headless Chromium,
whose Chrome TLS fingerprint passes the WAF. The scraper has been failing
for 10 consecutive days (2026-06-23 through 2026-07-02).
@symroe symroe mentioned this pull request Jul 4, 2026
symroe pushed a commit that referenced this pull request Jul 10, 2026
…int block

www.cne-siar.gov.uk returns HTTP 403 to wreq's Firefox133 TLS fingerprint.
The existing verify_requests=False addresses a certificate trust issue but
does not bypass the WAF's TLS fingerprint check. Adding http_lib="playwright"
switches to headless Chromium's Chrome TLS fingerprint, which passes the WAF
and allows the councillors page and individual detail pages to load correctly.
Same fix pattern as ELN (#410), FIF (#419), and other recently fixed councils.
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.

1 participant