Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes - Error: Couldn't find "tracks" in get_song_uri function #3

Closed
JackDevAU opened this issue Dec 7, 2020 · 1 comment
Closed

Comments

@JackDevAU
Copy link

Just tried adding my YouTube playlist to Spotify but the program kept crashing at a certain song.
Due to tracks not being found.

My Playlist ID: PLIC0u39_FdlMOtIwmwMNimn4r35Wy2Pc6

StackTrace

Traceback (most recent call last): File "C:\youtubetospotify-master\main.py", line 21, in <module> main() File "C:\youtubetospotify-master\main.py", line 14, in main song_uri = sp.get_song_uri(song.artist, song.title) File "C:\youtubetospotify-master\spotify.py", line 67, in get_song_uri items = results['tracks']['items'] KeyError: 'tracks'

Quick fix:

Added try, except block inside get_song_uri function

@ghost
Copy link

ghost commented Dec 7, 2020

I was able to reproduce the same error. It was caused by a 404 response from the server which my program didn't handle at all.
I have handled that error now. You can now try to run the updated version of program now. Although it had problems parsing most of the songs in the beginning, it managed to add most of the songs later on.

Thanks for the feedback!

@ghost ghost closed this as completed Dec 7, 2020
This issue was closed.
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

No branches or pull requests

1 participant