Repository navigation
fix: decode HTML entities in Odesli and iTunes-sourced titles - #89
Merged
Merged
Conversation
- Promote scraping._decode_entities to public decode_entities, reused from metadata.py's OG-tag path - Apply it in odesli.extract_metadata (title/artist) and itunes.canonicalise (trackName/artistName) - Both skipped the entity decode that metadata.py's scrapers already had; platform API clients are plain JSON, unaffected - Cover both with a test on an entity-encoded response
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.
Fixes titles rendering with raw HTML entities (e.g.
') instead of the decoded character, spotted on a kurl history card.Root cause
metadata.py's scrapers already decode HTML entities (_clean(), andextract_og_title/extract_og_descriptioninutils/scraping.py), but two other title/artist sources skipped it:clients/resolvers/odesli.py::extract_metadata-- readtitle/artistNamestraight from Odesli's JSON with no decode.clients/resolvers/itunes.py::canonicalise-- the iTunes Search API (Apple's legacy catalogue-lookup endpoint) is a known offender for returning&/'etc intrackName/artistName. This runs on the rescue/search path for direct ISRC matches inkurler.py-- a commonly-hit path.Swept the rest of the title/artist sources and found nothing else missing it: the 6 direct platform clients (Spotify/Apple/Deezer/SoundCloud/Tidal/YouTube) are plain JSON REST calls, no HTML in the loop.
What changed
scraping._decode_entitiesto publicdecode_entitiesrather than writing a second copy.odesli.extract_metadataanditunes.canonicalise.Tests
ruff checkclean.pytest380 passed (+2) -- both fixes covered with an entity-encoded response.🤖 Generated with Claude Code