Repository navigation
[pull] master from scrapinghub:master - #29
Merged
Merged
Conversation
Closes #87. Pages sometimes append junk to an otherwise valid value, most often a stray closing brace or semicolon, and the whole script was discarded over it. Whatever parses from the start of the script is now kept, using raw_decode, and the remainder is dropped with a warning naming how many characters were ignored. Since raw_decode reports where it stopped, this also picks up several values concatenated in one script, which previously failed as "Extra data". Truncated or wholly unparsable input still raises, so this only salvages scripts that do begin with a complete value. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closes #171. Escape sequences that are legal in a JavaScript string literal but not in JSON find their way into JSON-LD, and the script was discarded with "Invalid \escape". The reports involve apostrophes in names, reaching extruct as either \' or \x27. When the plainer parses have failed, escape sequences are now rewritten: \' becomes ', \x27 and friends become the equivalent \uXXXX, and any other backslash is doubled rather than dropped, so an unescaped Windows path or regular expression keeps its characters instead of losing them. Escapes are matched as a unit, so a "\\" pair is consumed whole and its second backslash is not mistaken for the start of another escape. Valid escapes are left untouched, which makes this a no-op on well-formed JSON; the repair is only attempted after a normal parse has already failed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )