Skip to content

Commit

Permalink
Skip song if track is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Hartog committed Jan 30, 2021
1 parent ee8b95b commit 4525272
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spotdl/search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,20 @@ def get_playlist_tracks(playlistUrl: str) -> List[SongObj]:
while True:

for songEntry in playlistResponse['items']:
if songEntry['track'] is None:
continue

song = SongObj.from_url(
'https://open.spotify.com/track/' + songEntry['track']['id'])

if song.get_youtube_link() != None:
playlistTracks.append(song)

# check if more tracks are to be passed
if playlistResponse['next']:
playlistResponse = spotifyClient.playlist_tracks(
playlistUrl,
offset = len(playlistTracks)
offset = playlistResponse['offset'] + playlistResponse['limit']
)
else:
break
Expand Down

0 comments on commit 4525272

Please sign in to comment.