From 4aae905a027875ab79ee50cd0b3e6c4e6dc63824 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Mon, 25 May 2020 17:31:07 +0200 Subject: [PATCH] Fix get_playlist for playlists with more than 1,000 songs (closes #25) --- tests/test.py | 2 +- ytmusicapi/ytmusic.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test.py b/tests/test.py index 94f8207..866fb65 100644 --- a/tests/test.py +++ b/tests/test.py @@ -115,7 +115,7 @@ class TestYTMusic(unittest.TestCase): ############### def test_get_foreign_playlist(self): - playlist = youtube.get_playlist("PLQwVIlKxHM6qv-o99iX9R85og7IzF9YS_", 300) + playlist = youtube.get_playlist("PL6bPxvf5dW5clc3y9wAoslzqUrmkZ5c-u", 300) self.assertGreater(len(playlist['tracks']), 200) def test_get_owned_playlist(self): diff --git a/ytmusicapi/ytmusic.py b/ytmusicapi/ytmusic.py index f1caf6c..fed6e0c 100644 --- a/ytmusicapi/ytmusic.py +++ b/ytmusicapi/ytmusic.py @@ -754,7 +754,8 @@ class YTMusic: playlist['year'] = nav(header, SUBTITLE3) if len(header['secondSubtitle']['runs']) > 1: - song_count = int(header['secondSubtitle']['runs'][0]['text'].split(' ')[0]) + song_count = \ + int(header['secondSubtitle']['runs'][0]['text'].split(' ')[0].replace(',', '')) playlist['duration'] = header['secondSubtitle']['runs'][2]['text'] else: playlist['duration'] = header['secondSubtitle']['runs'][0]['text']