Closed simonepignotti closed 1 year ago
Hi, I encounter the following error when running the YouTube.py script:
YouTube.py
4 playlists found. Starting transfer... Playlist 1: test Spotify tracks: 5/5 Could not transfer playlist WLG. Exception'videoId' [...]
Removing the try/except I get a better help message:
4 playlists found. Starting transfer... Playlist 1: test Spotify tracks: 5/5 Traceback (most recent call last): File "/Volumes/datvol/Perso/spym/spotifyplaylist_to_ytmusic/YouTube.py", line 190, in <module> main() File "/Volumes/datvol/Perso/spym/spotifyplaylist_to_ytmusic/YouTube.py", line 150, in main videoIds = ytmusic.search_songs(playlist['tracks']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Volumes/datvol/Perso/spym/spotifyplaylist_to_ytmusic/YouTube.py", line 74, in search_songs targetSong = self.get_best_fit_song_id(result, song) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Volumes/datvol/Perso/spym/spotifyplaylist_to_ytmusic/YouTube.py", line 43, in get_best_fit_song_id title_score[res['videoId']] = difflib.SequenceMatcher(a=title.lower(), b=song['name'].lower()).ratio() ~~~^^^^^^^^^^^ KeyError: 'videoId'
And this is what I get when I print req:
req
{'resultType': 'song', 'title': 'Avant Gardener', 'artists': [{'name': 'Courtney Barnett', 'id': 'UCAR6fZVOSmnctDecWdS9rtQ'}], 'album': {'name': 'The Double EP: A Sea of Split Peas', 'id': 'MPREb_T088NuxNhsq'}, 'duration': '5:13', 'duration_seconds': 313, 'thumbnails': [{'url': 'https://lh3.googleusercontent.com/D3R44aaDMdBbV5QZCk_qjizA-teEO2GtYDY62NjP1-fRVDhyk7Qh1AxFA5AOxMuk3GSM0Chpqg5Jicy4=w60-h60-l90-rj', 'width': 60, 'height': 60}, {'url': 'https://lh3.googleusercontent.com/D3R44aaDMdBbV5QZCk_qjizA-teEO2GtYDY62NjP1-fRVDhyk7Qh1AxFA5AOxMuk3GSM0Chpqg5Jicy4=w120-h120-l90-rj', 'width': 120, 'height': 120}]}
Hope that helps! Thanks for developing and maintaining this repo.
Hi Simone, please update your version of ytmusicapi to 0.25.2, that should fix it
ytmusicapi
0.25.2
Thanks a lot for the quick fix 👍
Hi, I encounter the following error when running the
YouTube.py
script:Removing the try/except I get a better help message:
And this is what I get when I print
req
:Hope that helps! Thanks for developing and maintaining this repo.