Fix STY (South Tyneside) scraper#436
Open
symroe wants to merge 1 commit into
Open
Conversation
… challenge https://www.southtyneside.gov.uk/article/13598/councillors-a-to-z returns HTTP 403 with cf-mitigated: challenge and server: cloudflare headers. wreq's Firefox TLS fingerprint triggers the Cloudflare managed challenge. Playwright uses headless Chromium which executes the JS challenge and acquires cf_clearance before fetching the page. The existing custom HTML selectors (#COUNCILLORSLISTBYNAME_HTML, tbody td a) remain unchanged — they were working before the Cloudflare block.
Member
Author
Re-scrape after 952a771Added
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
www.southtyneside.gov.uk/article/13598/councillors-a-to-zis protected by a Cloudflare managed challenge (cf-mitigated: challenge,server: cloudflare). wreq's Firefox TLS fingerprint receives HTTP 403 with a "Just a moment…" JS-challenge page rather than the councillors HTML. The scraper had nohttp_libset so wreq was used directly — same pattern as EAT (#409), FEN (#399), and others recently fixed. A previous issue (#385, closed as completed) described the same problem and proposed this fix.What was fixed
councillors.py: addedhttp_lib = "playwright"— headless Chromium executes the Cloudflare JS challenge, acquirescf_clearance, and then fetches both the list page and individual councillor detail pages. The existing custom HTML selectors (#COUNCILLORSLISTBYNAME_HTML,tbody td a) and thedecode_cfemailhelper are unchanged.Scrape results
The councillors page serves valid HTML to browser clients (confirmed: 403 is the Cloudflare challenge, not a permanent block). Previous successful run (before the Cloudflare block was added) returned councillors with emails decoded via
cf_emailand photos from the info table.Generated by Claude Code