[PR #612] [MERGED] get_playlist: title, artists and album are correctly resolved in collaborative playlists (#603) #672

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

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/612
Author: @czifumasa
Created: 6/30/2024
Status: Merged
Merged: 7/3/2024
Merged by: @sigma67

Base: mainHead: fix_collaborative_playlists


📝 Commits (3)

  • abb6ba7 get_playlist: title, artists and album are correctly resolved in collaborative playlists (#603)
  • c1a8713 Merge branch 'main' into czifumasa-fix_collaborative_playlists
  • 4207444 Merge branch 'main' into czifumasa-fix_collaborative_playlists

📊 Changes

1 file changed (+54 additions, -10 deletions)

View changed files

📝 ytmusicapi/parsers/playlists.py (+54 -10)

📄 Description

Fixed invalid playlist item info for collaborative playlists from #603 issue.
Instead of hardcoded indexes for flexColumns, now they are resolved using their navigationEndpoint with following logic:

  • watchEndpoint -> title
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_ALBUM -> album
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_ARTIST (Regular Artists) or pageType == MUSIC_PAGE_TYPE_UNKNOWN (Artists for uploaded songs)-> artists
  • browseEndpoint with pageType == MUSIC_PAGE_TYPE_USER_CHANNEL -> user channel

Additional checks:

  • sometimes song does not have navigable artist (example 4th track in https://music.youtube.com/playlist?list=OLAK5uy_mfa2N_1Ro0GZKmcrHLR_1VqSr30efpwTc). Then first unrecognized column is treated as artist.
  • for non-song videos the last user channel is treated as artist
    • In regular playlists non-song videos have single user channel column for the channel that uploaded video,
    • In collaborative playlists non-song videos have two user channel columns. First column for the channel that added video to the playlist. The song column for the channel that uploaded video.

Unavailable songs do not have navigationEndpoints so hardcoded indexes are still used. Collaborative user is not listed for unavailable song, so it should not be a problem.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/sigma67/ytmusicapi/pull/612 **Author:** [@czifumasa](https://github.com/czifumasa) **Created:** 6/30/2024 **Status:** ✅ Merged **Merged:** 7/3/2024 **Merged by:** [@sigma67](https://github.com/sigma67) **Base:** `main` ← **Head:** `fix_collaborative_playlists` --- ### 📝 Commits (3) - [`abb6ba7`](https://github.com/sigma67/ytmusicapi/commit/abb6ba780b5a7159af757880ad223d107dda3cc8) get_playlist: title, artists and album are correctly resolved in collaborative playlists (#603) - [`c1a8713`](https://github.com/sigma67/ytmusicapi/commit/c1a8713be0a51ceff1a969bfe37051f5f261befb) Merge branch 'main' into czifumasa-fix_collaborative_playlists - [`4207444`](https://github.com/sigma67/ytmusicapi/commit/4207444ed03b6c8e9d4dc9e3f9853d69e1a6d908) Merge branch 'main' into czifumasa-fix_collaborative_playlists ### 📊 Changes **1 file changed** (+54 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `ytmusicapi/parsers/playlists.py` (+54 -10) </details> ### 📄 Description Fixed invalid playlist item info for collaborative playlists from #603 issue. Instead of hardcoded indexes for flexColumns, now they are resolved using their navigationEndpoint with following logic: - `watchEndpoint` -> title - `browseEndpoint` with `pageType == MUSIC_PAGE_TYPE_ALBUM` -> album - `browseEndpoint` with `pageType == MUSIC_PAGE_TYPE_ARTIST` (Regular Artists) or `pageType == MUSIC_PAGE_TYPE_UNKNOWN` (Artists for uploaded songs)-> artists - `browseEndpoint` with `pageType == MUSIC_PAGE_TYPE_USER_CHANNEL` -> user channel Additional checks: - sometimes song does not have navigable artist (example 4th track in https://music.youtube.com/playlist?list=OLAK5uy_mfa2N_1Ro0GZKmcrHLR_1VqSr30efpwTc). Then first unrecognized column is treated as artist. - for non-song videos the last user channel is treated as artist - In regular playlists non-song videos have single user channel column for the channel that uploaded video, - In collaborative playlists non-song videos have two user channel columns. First column for the channel that added video to the playlist. The song column for the channel that uploaded video. Unavailable songs do not have navigationEndpoints so hardcoded indexes are still used. Collaborative user is not listed for unavailable song, so it should not be a problem. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 23:01:56 +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#672
No description provided.