sigma67/ytmusicapi

Incorrect track count for playlists with 1000+ songs

Closed this issue · 0 comments

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"])