Fixing KeyError: 'videoDetails' when syncing music using youtube music links #2376
+16
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
Fixing KeyError: 'videoDetails' when downloading from youtube links.
Description
Sometimes youtube APIs does not correctly returns the song object with "videoDetails", this cause spotdl to crash.
Related Issue
#2375
Motivation and Context
This change is required because spotdl sometimes crashes when downloading a big list of youtube music songs
How Has This Been Tested?
This has been tested locally with a debug session on vscode and with:
mapfile -t <000000_track_list.txt; /home/$USER/.local/bin/spotdl sync ${MAPFILE[@]} --config --headless --ignore-albums "live" "mixes" "in concert" "tour" --save-file 000000_sync.spotdl
/home/$USER/.local/bin/spotdl sync --config --headless --ignore-albums "live" "mixes" "in concert" "tour" --save-file 000000_sync.spotdl --scan-for-songs --overwrite metadata
000000_track_list.txt contains a very long list of yt music links, line by line - 5000+
Now when the song searched from youtube music link hasn't the "videoDetails" object, it just skips the song as it should.
Screenshots (if appropriate)
Types of Changes
Checklist