spotify_to_ytmusic
spotify_to_ytmusic copied to clipboard
Tracks that are missing from the YouTube playlist don't appear in the "noresults" file
My Spotify playlist has 1587 tracks. The YouTube playlist created has 1511. However, the "noresults" file only contains 4. I expect there to be 76.
Note: the playlist is named "1587" (the number of tracks) for convenience as I validate the transfer.
$ python YouTube.py https://open.spotify.com/playlist/0yasezcPZp9GvDpiIonDPv
Spotify tracks: 100/1587
Spotify tracks: 200/1587
Spotify tracks: 300/1587
Spotify tracks: 400/1587
Spotify tracks: 500/1587
Spotify tracks: 600/1587
Spotify tracks: 700/1587
Spotify tracks: 800/1587
Spotify tracks: 900/1587
Spotify tracks: 1000/1587
Spotify tracks: 1100/1587
Spotify tracks: 1200/1587
Spotify tracks: 1300/1587
Spotify tracks: 1400/1587
Spotify tracks: 1500/1587
Spotify tracks: 1587/1587
YouTube tracks: 10/1587
YouTube tracks: 20/1587
YouTube tracks: 30/1587
YouTube tracks: 40/1587
YouTube tracks: 50/1587
YouTube tracks: 60/1587
YouTube tracks: 70/1587
YouTube tracks: 80/1587
YouTube tracks: 90/1587
YouTube tracks: 100/1587
YouTube tracks: 110/1587
YouTube tracks: 120/1587
YouTube tracks: 130/1587
YouTube tracks: 140/1587
YouTube tracks: 150/1587
YouTube tracks: 160/1587
YouTube tracks: 170/1587
YouTube tracks: 180/1587
YouTube tracks: 190/1587
YouTube tracks: 200/1587
YouTube tracks: 210/1587
YouTube tracks: 220/1587
YouTube tracks: 230/1587
YouTube tracks: 240/1587
YouTube tracks: 250/1587
YouTube tracks: 260/1587
YouTube tracks: 270/1587
YouTube tracks: 280/1587
YouTube tracks: 290/1587
YouTube tracks: 300/1587
YouTube tracks: 310/1587
YouTube tracks: 320/1587
YouTube tracks: 330/1587
YouTube tracks: 340/1587
YouTube tracks: 350/1587
YouTube tracks: 360/1587
YouTube tracks: 370/1587
YouTube tracks: 380/1587
YouTube tracks: 390/1587
YouTube tracks: 400/1587
YouTube tracks: 410/1587
YouTube tracks: 420/1587
YouTube tracks: 430/1587
YouTube tracks: 440/1587
YouTube tracks: 450/1587
YouTube tracks: 460/1587
YouTube tracks: 470/1587
YouTube tracks: 480/1587
YouTube tracks: 490/1587
YouTube tracks: 500/1587
YouTube tracks: 510/1587
YouTube tracks: 520/1587
YouTube tracks: 530/1587
YouTube tracks: 540/1587
YouTube tracks: 550/1587
YouTube tracks: 560/1587
YouTube tracks: 570/1587
YouTube tracks: 580/1587
YouTube tracks: 590/1587
YouTube tracks: 600/1587
YouTube tracks: 610/1587
YouTube tracks: 620/1587
YouTube tracks: 630/1587
YouTube tracks: 640/1587
YouTube tracks: 650/1587
YouTube tracks: 660/1587
YouTube tracks: 670/1587
YouTube tracks: 680/1587
YouTube tracks: 690/1587
YouTube tracks: 700/1587
YouTube tracks: 710/1587
YouTube tracks: 720/1587
YouTube tracks: 730/1587
YouTube tracks: 740/1587
YouTube tracks: 750/1587
YouTube tracks: 760/1587
YouTube tracks: 770/1587
YouTube tracks: 780/1587
YouTube tracks: 790/1587
YouTube tracks: 800/1587
YouTube tracks: 810/1587
YouTube tracks: 820/1587
YouTube tracks: 830/1587
YouTube tracks: 840/1587
YouTube tracks: 850/1587
YouTube tracks: 860/1587
YouTube tracks: 870/1587
YouTube tracks: 880/1587
YouTube tracks: 890/1587
YouTube tracks: 900/1587
YouTube tracks: 910/1587
YouTube tracks: 920/1587
YouTube tracks: 930/1587
YouTube tracks: 940/1587
YouTube tracks: 950/1587
YouTube tracks: 960/1587
YouTube tracks: 970/1587
YouTube tracks: 980/1587
YouTube tracks: 990/1587
YouTube tracks: 1000/1587
YouTube tracks: 1010/1587
YouTube tracks: 1020/1587
YouTube tracks: 1030/1587
YouTube tracks: 1040/1587
YouTube tracks: 1050/1587
YouTube tracks: 1060/1587
YouTube tracks: 1070/1587
YouTube tracks: 1080/1587
YouTube tracks: 1090/1587
YouTube tracks: 1100/1587
YouTube tracks: 1110/1587
YouTube tracks: 1120/1587
YouTube tracks: 1130/1587
YouTube tracks: 1140/1587
YouTube tracks: 1150/1587
YouTube tracks: 1160/1587
YouTube tracks: 1170/1587
YouTube tracks: 1180/1587
YouTube tracks: 1190/1587
YouTube tracks: 1200/1587
YouTube tracks: 1210/1587
YouTube tracks: 1220/1587
YouTube tracks: 1230/1587
YouTube tracks: 1240/1587
YouTube tracks: 1250/1587
YouTube tracks: 1260/1587
YouTube tracks: 1270/1587
YouTube tracks: 1280/1587
YouTube tracks: 1290/1587
YouTube tracks: 1300/1587
YouTube tracks: 1310/1587
YouTube tracks: 1320/1587
YouTube tracks: 1330/1587
YouTube tracks: 1340/1587
YouTube tracks: 1350/1587
YouTube tracks: 1360/1587
YouTube tracks: 1370/1587
YouTube tracks: 1380/1587
YouTube tracks: 1390/1587
YouTube tracks: 1400/1587
YouTube tracks: 1410/1587
YouTube tracks: 1420/1587
YouTube tracks: 1430/1587
YouTube tracks: 1440/1587
YouTube tracks: 1450/1587
YouTube tracks: 1460/1587
YouTube tracks: 1470/1587
YouTube tracks: 1480/1587
YouTube tracks: 1490/1587
YouTube tracks: 1500/1587
YouTube tracks: 1510/1587
YouTube tracks: 1520/1587
YouTube tracks: 1530/1587
YouTube tracks: 1540/1587
YouTube tracks: 1550/1587
YouTube tracks: 1560/1587
YouTube tracks: 1570/1587
YouTube tracks: 1580/1587
Success: created playlist "1587"
https://music.youtube.com/playlist?list=PLxaUaA1nFpS1wfV9how_CgCBPCSy8AdHE
$ wc -l noresults_youtube.txt
4 noresults_youtube.txt
$ cat noresults_youtube.txt
Ess√°y Lyla
Crisopa Kit De Crein North Left - Kit De Crein Remix
Syntaks Shiftandshade Ahead
Off The Sky Agonic Drift
That is strange. How many videoIds do you have in l. 182 after running search_songs? You can add a breakpoint or debug print statement to find out. Perhaps also print out all the videoIds in case there is something strange going on.
https://github.com/sigma67/spotifyplaylist_to_ytmusic/blob/73083329f07bdcf9fed853e8fe9abfa2cd3d409e/YouTube.py#L182-L183
In main()
:
wc -l noresults_youtube.txt
: 3
len(videoIds)
: 1584
Then in add_playlist_items()
after OrderedDict.fromkeys(videoIds)
:
len(videoIds)
: 1512
YouTube Music playlist contains 1512.
I think it's either duplicate tracks or duplicate matches from songs that have similar names but different lengths? So maybe not an issue. I'll log the tracks names when there's a videoId
"collision" and see if that's true.
The Spotify playlist has duplicates (e.g. added from different region/language, or added by a different person). If I add the the number of missing and duplicate tracks I get what I expected.
Since duplicates will be matched to the same YouTube Music track, I suggest logging them in duplicates.txt
file. Then you can easily see that if you add noresults_youtube.txt
with duplicates.txt
you get the number of YouTube Music playlist tracks. I'll make a PR for this to show you what I mean.
The alternative is to remove duplicates from the Spotify playlist when it's first retrieved. But there are other tools to do that (eg. https://github.com/stavlocker/SpotifyNoDupes) if necessary.
~~Maybe I'm misremembering, but duplicates shouldn't be lost when transferring the playlist? If they are it would be a bug.~~
Edit: Nvm this is intentional behavior. Perhaps we should add a flag to include duplicates optionally, as it's not immediately apparent to the user
My issue is that my "noresults" file is generated but it's empty, and I expect there to be 9 tracks.
I'm using windows, running the "create" command from the "site-packages" folder. I had to rename main.py to main.py for it to work.
This happens with the "create" and "liked "commands (that I have tried so far). There are some tracks that are not found but don't appear in the "noresults" file. Examples of those are: 1. https://open.spotify.com/intl-es/track/0xMsn2VuXcfdf2Ksw4qz7G?si=53ba167f6cec4da2 Which should be found as: https://www.youtube.com/watch?v=mflNDS0tEOM&pp=ygURY29tcGFueSBzaXIgY2hsb2U%3D 2. https://open.spotify.com/intl-es/track/5UoCTv7xzBe9BytsuXxBqP?si=72c8c97b9735464f Which should be found as: https://youtu.be/mqps5JITgCI?si=7LehBYEDwWYLp4qH
Which now that I test them separately it seems that they get matched to the wrong song.
I'm getting this same issue, but i'm missing songs that aren't dupes. Nothing in the noresults file