Add videoId param for shuffling playlists (determines first video in shuffled playlist)
This commit is contained in:
parent
23f278cd85
commit
cc69b56c20
2 changed files with 11 additions and 8 deletions
|
|
@ -121,8 +121,8 @@ class TestYTMusic(unittest.TestCase):
|
||||||
self.assertEqual(len(playlist['tracks']), 12)
|
self.assertEqual(len(playlist['tracks']), 12)
|
||||||
|
|
||||||
def test_get_watch_playlist_shuffle_playlist(self):
|
def test_get_watch_playlist_shuffle_playlist(self):
|
||||||
playlist = youtube.get_watch_playlist_shuffle(
|
playlist = youtube_auth.get_watch_playlist_shuffle(
|
||||||
playlistId="PL528pVfw3ao0x8jlW3kwdIx1FEMMeeghb", limit=99)
|
videoId="u6XiiXJD0jg", playlistId="PL528pVfw3ao2VzfY6zE1TOZm1cBSdk7Q0", limit=99)
|
||||||
self.assertGreaterEqual(len(playlist['tracks']), 80)
|
self.assertGreaterEqual(len(playlist['tracks']), 80)
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ class WatchMixin:
|
||||||
body = {'enablePersistentPlaylistPanel': True, 'isAudioOnly': True}
|
body = {'enablePersistentPlaylistPanel': True, 'isAudioOnly': True}
|
||||||
if videoId:
|
if videoId:
|
||||||
body['videoId'] = videoId
|
body['videoId'] = videoId
|
||||||
|
if not params:
|
||||||
body['watchEndpointMusicSupportedConfigs'] = {
|
body['watchEndpointMusicSupportedConfigs'] = {
|
||||||
'watchEndpointMusicConfig': {
|
'watchEndpointMusicConfig': {
|
||||||
'hasPersistentPlaylistPanel': True,
|
'hasPersistentPlaylistPanel': True,
|
||||||
|
|
@ -89,13 +90,15 @@ class WatchMixin:
|
||||||
return {'tracks': tracks, 'lyrics': lyrics_browse_id}
|
return {'tracks': tracks, 'lyrics': lyrics_browse_id}
|
||||||
|
|
||||||
def get_watch_playlist_shuffle(self,
|
def get_watch_playlist_shuffle(self,
|
||||||
|
videoId: str = None,
|
||||||
playlistId: str = None,
|
playlistId: str = None,
|
||||||
limit=50) -> Dict[List[Dict], str]:
|
limit=50) -> Dict[List[Dict], str]:
|
||||||
"""
|
"""
|
||||||
Shuffle any playlist
|
Shuffle any playlist
|
||||||
|
|
||||||
|
:param videoId: Optional video id of the first video in the shuffled playlist
|
||||||
:param playlistId: Playlist id
|
:param playlistId: Playlist id
|
||||||
:param limit: The number of watch playlist items to return
|
:param limit: The number of watch playlist items to return
|
||||||
:return: A list of watch playlist items (see :py:func:`get_watch_playlist`)
|
:return: A list of watch playlist items (see :py:func:`get_watch_playlist`)
|
||||||
"""
|
"""
|
||||||
return self.get_watch_playlist(playlistId=playlistId, limit=limit, params='wAEB8gECGAE%3D')
|
return self.get_watch_playlist(videoId=videoId, playlistId=playlistId, limit=limit, params='wAEB8gECKAE%3D')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue