[GH-ISSUE #701] No play/view counts in get_playlist_info #454

Closed
opened 2026-02-27 23:00:53 +03:00 by kerem · 2 comments
Owner

Originally created by @asegret on GitHub (Dec 24, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/701

All the views are null when calling get_playlist_info()

The views are available when clicking "show all" on the artist channel page (it's displayed when the artist has more than 5 songs (I guess it is 5 because it only shows 5 on the channel page))

https://music.youtube.com/channel/UCZn4r7heNOPY-C43YIywnVA

All the songs of the channel are listed in a playlist, and the views/plays are displayed

https://music.youtube.com/playlist?list=OLAK5uy_nI8GFXPiq15Yp6hiTSgp2Y5-4J5fD3W44

I think it changed with this commit :

ytmusicapi/parsers/playlists.py
def parse_playlist_item
line 171

github.com/sigma67/ytmusicapi@d2cbe538de (diff-3df5031030)

minus :
views = get_item_text(data, 2) if flex_column_count == 4 or is_album else None

plus :
views = get_item_text(data, 2) if is_album else None

I added this locally and it worked for my use case :

views = get_item_text(data, 2) if len(data["flexColumns"]) == 4 or is_album else None
if views is not None:
    views = views.split(" ")[0]

To Reproduce

ytmusic = YTMusic()

playlist = ytmusic.get_playlist("OLAK5uy_nI8GFXPiq15Yp6hiTSgp2Y5-4J5fD3W44")

for index, track in enumerate(playlist.get('tracks', []), start=1):
    views = track.get('views', '')
    print(f"Views: {views}")

Additional context

I'm only using ytmusicapi to get stream numbers, I don't know the impact of that

I don't know if it use to work or not, I don't know anything about python and I'm using an LLM to help code some simple things in python, I'm absolutely not qualified to seriously code something in this language and do pull requests (I do java)

Originally created by @asegret on GitHub (Dec 24, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/701 All the views are null when calling get_playlist_info() The views are available when clicking "show all" on the artist channel page (it's displayed when the artist has more than 5 songs (I guess it is 5 because it only shows 5 on the channel page)) https://music.youtube.com/channel/UCZn4r7heNOPY-C43YIywnVA All the songs of the channel are listed in a playlist, and the views/plays are displayed https://music.youtube.com/playlist?list=OLAK5uy_nI8GFXPiq15Yp6hiTSgp2Y5-4J5fD3W44 I think it changed with this commit : ytmusicapi/parsers/playlists.py def parse_playlist_item line 171 https://github.com/sigma67/ytmusicapi/commit/d2cbe538dedbb73a8a34820ef2c5fe13a453076a#diff-3df5031030978f7252957f4155230cbbd431d129df20b745e12cd54723bd1c94L108 minus : views = get_item_text(data, 2) if flex_column_count == 4 or is_album else None plus : views = get_item_text(data, 2) if is_album else None I added this locally and it worked for my use case : views = get_item_text(data, 2) if len(data["flexColumns"]) == 4 or is_album else None if views is not None: views = views.split(" ")[0] **To Reproduce** ytmusic = YTMusic() playlist = ytmusic.get_playlist("OLAK5uy_nI8GFXPiq15Yp6hiTSgp2Y5-4J5fD3W44") for index, track in enumerate(playlist.get('tracks', []), start=1): views = track.get('views', '') print(f"Views: {views}") **Additional context** I'm only using ytmusicapi to get stream numbers, I don't know the impact of that I don't know if it use to work or not, I don't know anything about python and I'm using an LLM to help code some simple things in python, I'm absolutely not qualified to seriously code something in this language and do pull requests (I do java)
kerem closed this issue 2026-02-27 23:00:53 +03:00
Author
Owner

@sigma67 commented on GitHub (Dec 24, 2024):

Please try to follow the bug report template or I'm forced to close this one because I only understand about half of what you're trying to tell

<!-- gh-comment-id:2561471894 --> @sigma67 commented on GitHub (Dec 24, 2024): Please try to follow the bug report template or I'm forced to close this one because I only understand about half of what you're trying to tell
Author
Owner

@sigma67 commented on GitHub (Dec 27, 2024):

You are using get_playlist for an album. Use get_album_browse_id and get_album instead.

There is also a PR here that could make it work for you: https://github.com/sigma67/ytmusicapi/pull/696

<!-- gh-comment-id:2563884260 --> @sigma67 commented on GitHub (Dec 27, 2024): You are using `get_playlist` for an album. Use `get_album_browse_id` and `get_album` instead. There is also a PR here that could make it work for you: https://github.com/sigma67/ytmusicapi/pull/696
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#454
No description provided.