mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-13 04:55:13 +00:00
[ie/youtube] Fix web_embedded client extraction (#14843)
Closes #14826 Authored by: bashonly, seproDev Co-authored-by: sepro <sepro@sepr0.com>
This commit is contained in:
@@ -380,10 +380,13 @@ def short_client_name(client_name):
|
|||||||
return join_nonempty(main[:4], ''.join(x[0] for x in parts)).upper()
|
return join_nonempty(main[:4], ''.join(x[0] for x in parts)).upper()
|
||||||
|
|
||||||
|
|
||||||
def build_innertube_clients():
|
def _fix_embedded_ytcfg(ytcfg):
|
||||||
THIRD_PARTY = {
|
ytcfg['INNERTUBE_CONTEXT'].setdefault('thirdParty', {}).update({
|
||||||
'embedUrl': 'https://www.youtube.com/', # Can be any valid URL
|
'embedUrl': 'https://www.youtube.com/', # Can be any valid URL
|
||||||
}
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def build_innertube_clients():
|
||||||
BASE_CLIENTS = ('ios', 'web', 'tv', 'mweb', 'android')
|
BASE_CLIENTS = ('ios', 'web', 'tv', 'mweb', 'android')
|
||||||
priority = qualities(BASE_CLIENTS[::-1])
|
priority = qualities(BASE_CLIENTS[::-1])
|
||||||
|
|
||||||
@@ -405,7 +408,7 @@ def build_innertube_clients():
|
|||||||
ytcfg['priority'] = 10 * priority(base_client)
|
ytcfg['priority'] = 10 * priority(base_client)
|
||||||
|
|
||||||
if variant == 'embedded':
|
if variant == 'embedded':
|
||||||
ytcfg['INNERTUBE_CONTEXT']['thirdParty'] = THIRD_PARTY
|
_fix_embedded_ytcfg(ytcfg)
|
||||||
ytcfg['priority'] -= 2
|
ytcfg['priority'] -= 2
|
||||||
elif variant:
|
elif variant:
|
||||||
ytcfg['priority'] -= 3
|
ytcfg['priority'] -= 3
|
||||||
@@ -991,6 +994,10 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
|
|
||||||
ytcfg = self.extract_ytcfg(video_id, webpage) or {}
|
ytcfg = self.extract_ytcfg(video_id, webpage) or {}
|
||||||
|
|
||||||
|
# See https://github.com/yt-dlp/yt-dlp/issues/14826
|
||||||
|
if _split_innertube_client(client)[2] == 'embedded':
|
||||||
|
_fix_embedded_ytcfg(ytcfg)
|
||||||
|
|
||||||
# Workaround for https://github.com/yt-dlp/yt-dlp/issues/12563
|
# Workaround for https://github.com/yt-dlp/yt-dlp/issues/12563
|
||||||
# But it's not effective when logged-in
|
# But it's not effective when logged-in
|
||||||
if client == 'tv' and not self.is_authenticated:
|
if client == 'tv' and not self.is_authenticated:
|
||||||
|
|||||||
Reference in New Issue
Block a user