Skip to content

fix: decode HTML entities in Odesli and iTunes-sourced titles - #89

Merged
johnshields merged 1 commit into
mainfrom
fix/odesli-html-entities
Sep 11, 2026
Merged

johnshields merged 1 commit into
mainfrom
fix/odesli-html-entities

Conversation

@johnshields

Copy link
Copy Markdown
Owner

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(), and extract_og_title/extract_og_description in utils/scraping.py), but two other title/artist sources skipped it:

  • clients/resolvers/odesli.py::extract_metadata -- read title/artistName straight 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 in trackName/artistName. This runs on the rescue/search path for direct ISRC matches in kurler.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

  • Promoted the existing private scraping._decode_entities to public decode_entities rather than writing a second copy.
  • Applied it in odesli.extract_metadata and itunes.canonicalise.

Tests

ruff check clean. pytest 380 passed (+2) -- both fixes covered with an entity-encoded response.

🤖 Generated with Claude Code

- 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
@johnshields
johnshields merged commit 443d688 into main Sep 11, 2026
4 checks passed
@johnshields
johnshields deleted the fix/odesli-html-entities branch September 11, 2026 02:04
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