[GH-ISSUE #650] Incorrect track count for playlists with 1000+ songs #438

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

Originally created by @RealCalumPlays on GitHub (Sep 28, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/650

Hello all,

This is an issue with the regex in the playlist mixin. It causes only the first group to be returned. For example if the playlist had 3647 songs it would return 3 due to how re.search(r"\d+", song_count_text) is used.

To Reproduce
Steps to reproduce the behavior:

  1. Find a playlist with 1000+ songs
  2. Use the YTMusic.get_playlist() function
  3. Print the trackCount object.
  4. It should return only the first digit

Additional context

from ytmusicapi import YTMusic

# Initialize YouTube Music API
ytmusic = YTMusic()

PLAYLIST_ID = "XXXXXX"

# Call get_playlist
playlist = ytmusic.get_playlist(PLAYLIST_ID)

#Print trackCount to the console
print(playlist["trackCount"])
Originally created by @RealCalumPlays on GitHub (Sep 28, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/650 Hello all, This is an issue with the regex in the playlist mixin. It causes only the first group to be returned. For example if the playlist had `3647` songs it would return `3` due to how `re.search(r"\d+", song_count_text)` is used. **To Reproduce** Steps to reproduce the behavior: 1. Find a playlist with 1000+ songs 2. Use the `YTMusic.get_playlist()` function 3. Print the `trackCount` object. 4. It should return only the first digit **Additional context** ```python from ytmusicapi import YTMusic # Initialize YouTube Music API ytmusic = YTMusic() PLAYLIST_ID = "XXXXXX" # Call get_playlist playlist = ytmusic.get_playlist(PLAYLIST_ID) #Print trackCount to the console print(playlist["trackCount"]) ```
kerem closed this issue 2026-02-27 23:00:47 +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#438
No description provided.