-
Notifications
You must be signed in to change notification settings - Fork 273
Open
Description
Description
get_playlist() crashes with TypeError: 'NoneType' object is not subscriptable when fetching OLAK playlists that don't have album info on all tracks (e.g., chart/trending playlists).
Reproduction
Library version: 1.11.5
Steps:
from ytmusicapi import YTMusic
ytm = YTMusic()
playlist = ytm.get_playlist("OLAK5uy_mzYnlaHgFOvLaxqIPnnouEr-idiUn4NIM") # Trending 20 SpainError:
TypeError: 'NoneType' object is not subscriptable
File "ytmusicapi/parsers/playlists.py", line 122, in parse_audio_playlist
playlist["title"] = playlist["tracks"][0]["album"]["name"]
Root Cause
parse_audio_playlist() assumes all OLAK playlists are album playlists where every track has album info. However, chart playlists like "Trending 20 Spain" use the OLAK prefix but contain music videos (OMVs) without album info.
Proposed Fix
Make parse_audio_playlist() return None when not all tracks have album info, allowing the caller to fall back to regular playlist parsing.
I have a fix ready and will submit a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels