Incorrect track count for playlists with 1000+ songs
Closed this issue · 0 comments
RealCalumPlays commented
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:
- Find a playlist with 1000+ songs
- Use the
YTMusic.get_playlist()
function - Print the
trackCount
object. - 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"])