SathyaBhat / spotify-dl

Downloads songs from your Spotify Playlist
http://sathyasays.com/2015/12/29/spotify-dl-download-your-spotify-my-music-songs-as-mp3/
MIT License
1.72k stars 211 forks source link

Compare song lengths #81

Open lucanello opened 4 years ago

lucanello commented 4 years ago

Currently, there is no comparison if the found YouTube video matches the song. The only similarities are the song title and search query for YouTube.

There should be a feature added which makes sure that the found YouTube video is the right song. This feature has also been mentioned in https://github.com/SathyaBhat/spotify-dl/issues/39. But the suggested solution of using NLP for comparing the song title with the video title seems extremely hard to implement for a quite small improvement - because videos could only contain the song title and therefore be a false positive.

An easier way to implement a feature which makes sure the right video is selected could be a comparator between the song and video length. The video should always be about the same length as the song, otherwise something is wrong. There could be a variable which can be modified and tells how many percent the video length can be off. That reduces the risk of false positives (sometimes there are intros and outros added to the YouTube videos).

E.g.: max_length_difference = 0.1 -> A song on Spotify with 3 minutes (= 180 seconds) playtime has to be within the range of 162 seconds to 198 seconds video length.

Informations like the Spotify song length can be extracted from the API, as well as the video length from the HTML and/or the YouTube API.

SathyaBhat commented 4 years ago

@lucanello adding you as the assignee - if not let me know

last72 commented 3 years ago

Agreed. I was thinking to manually find the YouTube videos and input to provide best result. We are in same boat in whole.

Fabian42 commented 3 years ago

Example to reproduce: Title: "Beautiful people" Artist: "Thomas Bergersen" (together with Merethe Soltvedt) Spotify link: https://open.spotify.com/track/4L2cTneQccxklpCcX0BboM Duration: 4m57s

Spotify_dl downloads this YouTube video: https://www.youtube.com/watch?v=iTsz5x3abJA Title: "Thomas Bergersen - We Are One Beautiful People" on the channel "Two Steps From Hell" Duration: 6m47s The channel is correct, it's one of the official ones, but the track is not correct, it's a mix between "We are one" and "Beautiful people". I don't know why spotify_dl picked this one. There is a shortened URL to the Spotify album in the video description, but that's the only connection. I don't know how spotify_dl would know that it's the correct channel.

There is this fan-made video that seems to contain the original audio: https://www.youtube.com/watch?v=FNUxeUsaRCY Duration: 4m58s It's the first result for the search that spotify_dl uses, but by some metric it chooses the other one instead. I have not verified yet whether the track is actually exactly the same, has the best audio quality, etc.