spotifylyrics icon indicating copy to clipboard operation
spotifylyrics copied to clipboard

How to use another source to find french rap lyrics ?

Open sanjuant opened this issue 4 years ago • 3 comments

Hello,

I noticed that unfortunately the bank of lyrics for French rap was rather weak.

Is it possible to include another source to have more lyrics available?

Currently via the Deezer API it is possible to retrieve a lot of lyrics. To do this you first need to retrieve the song id https://api.deezer.com/search?q=sch,marche%20noir .

Then you have to call the API with this id.

https://www.deezer.com/ajax/gw-light.php?method=song.getLyrics&api_version=1.0&api_token=[api-token]&sng_id=[song-id]

Source: https://stackoverflow.com/questions/42165724/how-to-get-lyrics-from-the-deezer-api#answer-59822502

I would be happy to contribute if you put me on the track to add sources ;).

sanjuant avatar Feb 26 '21 17:02 sanjuant

Hi,

for adding a source you just have to write a function which fetches the lyrics like this:

https://github.com/SimonIT/spotifylyrics/blob/fb1fdc3d09741d80d4fb3cb3c8e17282ab105c8c/services.py#L299-L316

The function has to be added than there (for not synchronized):

https://github.com/SimonIT/spotifylyrics/blob/fb1fdc3d09741d80d4fb3cb3c8e17282ab105c8c/backend.py#L179

The problem what I see is the api token. Every source fetches currently the lyrics from the webpage. There is no menu for setting an api token and because most of the users use the .exe file of this program, it would be necessary to add such menu to use the api. (I don't want that everyone uses mine token.) Another idea is to fetch the lyrics from the normal webpage like we do with the other pages

SimonIT avatar Feb 27 '21 09:02 SimonIT

Okay, Thank you for the answer and the examples.

I understand what is at stake. Would it be possible to add the possibility of putting our identifiers for certain services?

Having a free account on Deezer allows you to get a lot of lyrics. But to display these lyrics, you must have a premium account and the lyrics are displayed as you read song with the time code.

To see example of JSON you can see this pastebin : https://pastebin.com/mLg3ZFLh

sanjuant avatar Feb 27 '21 20:02 sanjuant

The current supported format for synchronized lyrics is lrc. With some extra effort, it will be surely possible to get the also the json format displayed.

The easiest way would be to use the settings.ini to set an api token. The file is loaded here: https://github.com/SimonIT/spotifylyrics/blob/fb1fdc3d09741d80d4fb3cb3c8e17282ab105c8c/SpotifyLyrics.pyw#L209-L300

SimonIT avatar Feb 27 '21 22:02 SimonIT