mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-12 20:23:11 +00:00
[youtube] Improve channel syncid extraction to support ytcfg (#241)
Authored by: colethedj
This commit is contained in:
parent
921b76cab8
commit
8ea3f7b909
@ -336,14 +336,19 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _extract_account_syncid(data):
|
def _extract_account_syncid(data):
|
||||||
"""Extract syncId required to download private playlists of secondary channels"""
|
"""
|
||||||
sync_ids = (
|
Extract syncId required to download private playlists of secondary channels
|
||||||
try_get(data, lambda x: x['responseContext']['mainAppWebResponseContext']['datasyncId'], compat_str)
|
@param data Either response or ytcfg
|
||||||
or '').split("||")
|
"""
|
||||||
|
sync_ids = (try_get(
|
||||||
|
data, (lambda x: x['responseContext']['mainAppWebResponseContext']['datasyncId'],
|
||||||
|
lambda x: x['DATASYNC_ID']), compat_str) or '').split("||")
|
||||||
if len(sync_ids) >= 2 and sync_ids[1]:
|
if len(sync_ids) >= 2 and sync_ids[1]:
|
||||||
# datasyncid is of the form "channel_syncid||user_syncid" for secondary channel
|
# datasyncid is of the form "channel_syncid||user_syncid" for secondary channel
|
||||||
# and just "user_syncid||" for primary channel. We only want the channel_syncid
|
# and just "user_syncid||" for primary channel. We only want the channel_syncid
|
||||||
return sync_ids[0]
|
return sync_ids[0]
|
||||||
|
# ytcfg includes channel_syncid if on secondary channel
|
||||||
|
return data.get('DELEGATED_SESSION_ID')
|
||||||
|
|
||||||
def _extract_ytcfg(self, video_id, webpage):
|
def _extract_ytcfg(self, video_id, webpage):
|
||||||
return self._parse_json(
|
return self._parse_json(
|
||||||
|
Loading…
Reference in New Issue
Block a user