Skip to content

fix(whoscored): unwrap JSON wrapped in HTML <pre> from page_source#944

Open
SAY-5 wants to merge 1 commit into
probberechts:masterfrom
SAY-5:fix/940-whoscored-json-html-wrapping
Open

fix(whoscored): unwrap JSON wrapped in HTML <pre> from page_source#944
SAY-5 wants to merge 1 commit into
probberechts:masterfrom
SAY-5:fix/940-whoscored-json-html-wrapping

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

Fixes #940.

WhoScored.read_schedule and other endpoints call json.load on the response returned by get(..., var=None). In 1.9.0 the response is the page source returned by Selenium, which browsers render as <html><body><pre>{...}</pre></body></html> for raw JSON URLs. json.load then raises JSONDecodeError.

Override _validate_page on WhoScored to detect that wrapper and return the underlying JSON text, with a fallthrough that preserves the existing HTML path.

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.

[WhoScored] read_schedule() fails with JSONDecodeError in 1.9.0

1 participant