From 3d9a3bf5981bcf77c082a5acedd97ed2001876e8 Mon Sep 17 00:00:00 2001 From: girst Date: Tue, 15 Aug 2023 20:44:38 +0000 Subject: [PATCH] protobuf: replace make_playlist_params with new library removes the large comment listing all the playlist types. --- app/browse/protobuf.py | 52 ++++++------------------------------------ 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/app/browse/protobuf.py b/app/browse/protobuf.py index d3ebd28..e3a0768 100644 --- a/app/browse/protobuf.py +++ b/app/browse/protobuf.py @@ -104,50 +104,12 @@ def make_channel_params(subject, typ="videos", sort=None, query=None): # }}} CHANNEL # PLAYLIST {{{ -@message -@dataclass -class PlaylistData: - offset: Optional[int64] = field(1) # normal playlists - after: Optional[str] = field(2) # mix playlist (RDCL*, RDCM*): video id of last loaded item (how to get first page!?) -@message -@dataclass -class PlaylistSubparams: - data: str = field(15) def make_playlist_params(playlist_id, offset): - # TODO: special type of playlists: (see https://github.com/nlitsme/youtube_tool) - # - PL*: normal playlists - # - special channel playlists (suffix=channel_id without UC): - # - UU*: newest uploads (works) - # - PU*: popular uploads (works) - # Note: youtubekids (e.g. PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4) fallback-only (youtube webui 404's) - # - FL*: favourited uploads (works; 404's if private) - # - LL*: liked uploads (untested) - # - RDCMUC*: mix for channel (fallback only; e.g. RDCMUCYO_jab_esuFRV4b17AJtAw, undisplayable on youtube (only works on watch)) - # - CL, EL, MQ, TT: unknown - # - OLAK5uy_ music album playlist (works, e.g. OLAK5uy_m4xAFdmMC5rX3Ji3g93pQe3hqLZw_9LhM) - # - RD*: mix playlist (works with after=; e.g. RDCLAK5uy_kLWIr9gv1XLlPbaDS965-Db4TrBoUTxQ8, RDCLAK5uy_mx8mvGaCkyI12AedAu8yIbBpEYmg6Ayow, RDCLAK5uy_n340faD9pPGRVEVwozYTzIpfXuqmQwcgA, RDCLAK5uy_kQmVjdr90p2onIIAnijgU8u9iUUAOXM2I) - # https://www.youtube.com/watch?v=FTQbiNvZqaY&list=RDCLAK5uy_khNGopKCT_t38MZ1W7z4kERrqprkXovxo&start_radio=1 - # - EC, UL, TL: unknown - # - own user playlists (obviously not working): - # - RDMM: my mix - # - WL: watch later - # - LL: own liked videos - # - LM: own liked youtube-music videos - after = None - if playlist_id.startswith("RD"): - # NOTE: this only fixes RDCLAK5uy_, not RDCMUC - after = '___________' # any video id that doesn't exist within the playlist requests the beginning - offset = None - - return b64e(Continuation( - params=Params( - subject="VL" + playlist_id, - params=b64e(PlaylistSubparams( - data="PT:" + b64e(PlaylistData( - offset=offset, - after=after, - ).dumps(), padding=False) - ).dumps()), - ), - ).dumps()) + # mix takes video id instead of offset. an id not in the playlist requests the beginning. + mix_playlist = playlist_id.startswith("RD") + return continuation("VL" + playlist_id, { + 15: "PT:" + proto( + { 2: '___________' } if mix_playlist else { 1: offset } + ) + }) # }}} PLAYLIST -- 2.39.3