Skip to content

Comments

Added song lyrics to GUI#158

Open
kl wants to merge 1 commit intomarin-m:mainfrom
kl:master
Open

Added song lyrics to GUI#158
kl wants to merge 1 commit intomarin-m:mainfrom
kl:master

Conversation

@kl
Copy link

@kl kl commented Mar 15, 2024

Hello and thanks for making this awesome app!

This pull request adds display of song lyrics to the GUI below the album art. Resolves #88

Uses the (open) API from https://lrclib.net for fetching song lyrics, but it should be easy to add more/better lyrics API if they exist(?). The API is pretty good but fails sometimes on more obscure songs.

songrec-lyrics

@kl
Copy link
Author

kl commented Mar 15, 2024

There's another lyrics API I found at https://lyrics.astrid.sh which finds a lot more songs so it might be better to use that instead. Only thing is I think they are scraping genius.com which is probably against their TOS. What do you think?

@kl
Copy link
Author

kl commented Mar 20, 2024

After looking at this a bit more I think scraping genius is the way to go so I wrote some code to do that. It should be faster and more robust (better handling of parenthesis for example) than going through a 3rd party api. From my testing the accuracy is pretty good.

As with any scraping though breakage could happen at any time, but if you merge this I'm willing to update the scraping code if it breaks.

Something I haven't added is a feature gate (is this wanted?). Could also add an enable checkbox to preferences?

edit: I also enabled the gzip feature on reqwest to reduce the size when fetching the genius html

@kl kl force-pushed the master branch 4 times, most recently from 3ee2001 to 02a71bf Compare March 22, 2024 08:04
@marin-m
Copy link
Owner

marin-m commented Mar 31, 2024

Hello,

Thank you for your pull request!

Integrating code scraping towards https://genius.com/ seems like a bad idea, this is a Cloudflare-backed HTML frontend, they may have ML heuristics that will detect the pattern of the software and eventually serve captchas/decrease the reputation of SongRec users IP addresses.

There's another lyrics API I found at https://lyrics.astrid.sh/ which finds a lot more songs so it might be better to use that instead. Only thing is I think they are scraping genius.com

It's a small Node.js module querying https://api.genius.com/ (see https://docs.genius.com/), but it requires to manually specify an API token from the configuration (source code)

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.

Add ability to show song lyrics

2 participants