Add letras.com lyrics fetcher - #664
Open
jairogaleano wants to merge 4 commits into
Open
jairogaleano wants to merge 4 commits into
jairogaleano wants to merge 4 commits into
Conversation
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.
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.
What
Adds
letras.comas a lyrics source for the lyrics screen:LetrasFetcherthat scrapes thelyric-originalblock from letras.com song pages.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.&→and) when Solr is unreachable.mago de oz / al-mejandriasample 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
lyrics_fetcher.*.lyrics_fetcherslist; happy to add it globally or as a follow-up if you'd like it on by default.