[GH-ISSUE #853] get_playlist() crashes on OLAK chart playlists without album info #520

Closed
opened 2026-02-27 23:01:15 +03:00 by kerem · 0 comments
Owner

Originally created by @guillevc on GitHub (Jan 21, 2026).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/853

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 Spain

Error:

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.

Originally created by @guillevc on GitHub (Jan 21, 2026). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/853 ## 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:** ```python from ytmusicapi import YTMusic ytm = YTMusic() playlist = ytm.get_playlist("OLAK5uy_mzYnlaHgFOvLaxqIPnnouEr-idiUn4NIM") # Trending 20 Spain ``` **Error:** ``` 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.
kerem closed this issue 2026-02-27 23:01:15 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#520
No description provided.