Fix errors for unplayable items
This commit is contained in:
parent
31d0e88730
commit
947bbcc17b
2 changed files with 9 additions and 12 deletions
|
|
@ -113,12 +113,12 @@ class TestYTMusic(unittest.TestCase):
|
||||||
###############
|
###############
|
||||||
|
|
||||||
def test_get_foreign_playlist(self):
|
def test_get_foreign_playlist(self):
|
||||||
playlist = youtube.get_playlist("PLQwVIlKxHM6qv-o99iX9R85og7IzF9YS_", 200)
|
playlist = youtube.get_playlist("PLQwVIlKxHM6qv-o99iX9R85og7IzF9YS_", 300)
|
||||||
self.assertEqual(len(playlist['tracks']), 200)
|
self.assertGreater(len(playlist['tracks']), 200)
|
||||||
|
|
||||||
def test_get_owned_playlist(self):
|
def test_get_owned_playlist(self):
|
||||||
playlist = youtube_auth.get_playlist(config['playlists']['own'], 300)
|
playlist = youtube_auth.get_playlist(config['playlists']['own'], 300)
|
||||||
self.assertEqual(len(playlist['tracks']), 282)
|
self.assertGreater(len(playlist['tracks']), 200)
|
||||||
|
|
||||||
def test_edit_playlist(self):
|
def test_edit_playlist(self):
|
||||||
playlist = youtube_auth.get_playlist(config['playlists']['own'])
|
playlist = youtube_auth.get_playlist(config['playlists']['own'])
|
||||||
|
|
|
||||||
|
|
@ -107,15 +107,12 @@ def parse_playlist_items(results):
|
||||||
videoId = nav(
|
videoId = nav(
|
||||||
data, PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId']
|
data, PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId']
|
||||||
|
|
||||||
for item in nav(data, MENU_ITEMS):
|
for item in nav(data, MENU_ITEMS):
|
||||||
if 'menuServiceItemRenderer' in item and 'playlistEditEndpoint' in nav(
|
if 'menuServiceItemRenderer' in item and 'playlistEditEndpoint' in nav(
|
||||||
item, MENU_SERVICE):
|
item, MENU_SERVICE):
|
||||||
setVideoId = nav(
|
setVideoId = nav(
|
||||||
item, MENU_SERVICE)['playlistEditEndpoint']['actions'][0]['setVideoId']
|
item, MENU_SERVICE)['playlistEditEndpoint']['actions'][0]['setVideoId']
|
||||||
videoId = nav(
|
break
|
||||||
item,
|
|
||||||
MENU_SERVICE)['playlistEditEndpoint']['actions'][0]['removedVideoId']
|
|
||||||
break
|
|
||||||
|
|
||||||
title = get_item_text(data, 0)
|
title = get_item_text(data, 0)
|
||||||
if title == 'Song deleted':
|
if title == 'Song deleted':
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue