Skip to content

Add letras.com lyrics fetcher - #664

Open
jairogaleano wants to merge 4 commits into
ncmpcpp:masterfrom
jairogaleano:letras-fetcher
Open

jairogaleano wants to merge 4 commits into
ncmpcpp:masterfrom
jairogaleano:letras-fetcher

Conversation

@jairogaleano

Copy link
Copy Markdown

What

Adds letras.com as a lyrics source for the lyrics screen:

  • New LetrasFetcher that scrapes the lyric-original block from letras.com song pages.
  • Instead of guessing the final page URL, the fetcher queries letras.com's own Solr index (https://solr.sscdn.co/letras/m1/?q=<artist+title>&wt=json), drops "part N" tokens from the query, and picks the result whose normalized title (part/pt/parte/roman numerals) matches the tag — so multi-part tracks like Another Brick In The Wall, Part 2 resolve to the exact PT.2 page instead of the wrong part.
  • Falls back to matching the first artist hit, and to a direct slug URL (accent folding, &and) when Solr is unreachable.
  • Adds a mago de oz / al-mejandria sample to --test-lyrics-fetchers.

Why

The existing fetchers ultimately depend on google.com searches, which is unreliable in some networks. letras.com is a direct, self-hosted Spanish/Portuguese lyrics site; its slug URLs (lowercase, - separated) are linkable directly, but multi-part/duplicated titles redirect to the wrong page, hence the Solr + normalized-title matching.

Notes

  • Deliberately does not touch the lyrics-fetching crash addressed in Fix crash on fetching lyrics #662 (already proposed by cornelius-sevald) — this PR is limited to the new fetcher and its tests. The two changes are independent, though both touch lyrics_fetcher.*.
  • Not added to the default lyrics_fetchers list; happy to add it globally or as a follow-up if you'd like it on by default.
  • Scraping a site's own public page/its search endpoint carries ToS considerations for whatever site is selected as a default — flagging for maintainer review.

Jairo Galeno and others added 4 commits September 12, 2026 17:59
Scrape lyrics from letras.com (matching <div class="[...]lyric-original[...]">)
as an alternative/complement to the existing google-based fetchers.
… ones

letras.com lowercases the artist segment but 307-redirect-loops on
percent-encoded titles (spaces, parentheses, commas), so lyrics are
never found (e.g. 'Pink Floyd / Another Brick In The Wall (Part 2)').

Build the URL from slugified artist/title (lowercase, spaces -> '-',
strip punctuation, & -> 'and', accent folding) so every look-up is a
direct 200 + lyric-original extraction.
Slug URL guessing breaks on multi-part/duplicate songs (letras.com maps
part-1 -> PT.2, part-2 -> PT.1). Query the site's own Solr index, drop
'part N' tokens from the query, and pick the doc whose normalized title
(pt/part/romans) equals the tag before fetching the canonical page.
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