mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-21 12:34:08 +00:00
[ted] Prefer own formats over external sources (closes #29142)
This commit is contained in:
parent
f3cd1d9cec
commit
6511b8e8d7
@ -123,6 +123,10 @@ class TEDIE(InfoExtractor):
|
|||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
# with own formats and private Youtube external
|
||||||
|
'url': 'https://www.ted.com/talks/spencer_wells_a_family_tree_for_humanity',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_NATIVE_FORMATS = {
|
_NATIVE_FORMATS = {
|
||||||
@ -210,16 +214,6 @@ class TEDIE(InfoExtractor):
|
|||||||
|
|
||||||
player_talk = talk_info['player_talks'][0]
|
player_talk = talk_info['player_talks'][0]
|
||||||
|
|
||||||
external = player_talk.get('external')
|
|
||||||
if isinstance(external, dict):
|
|
||||||
service = external.get('service')
|
|
||||||
if isinstance(service, compat_str):
|
|
||||||
ext_url = None
|
|
||||||
if service.lower() == 'youtube':
|
|
||||||
ext_url = external.get('code')
|
|
||||||
|
|
||||||
return self.url_result(ext_url or external['uri'])
|
|
||||||
|
|
||||||
resources_ = player_talk.get('resources') or talk_info.get('resources')
|
resources_ = player_talk.get('resources') or talk_info.get('resources')
|
||||||
|
|
||||||
http_url = None
|
http_url = None
|
||||||
@ -294,6 +288,16 @@ class TEDIE(InfoExtractor):
|
|||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if not formats:
|
||||||
|
external = player_talk.get('external')
|
||||||
|
if isinstance(external, dict):
|
||||||
|
service = external.get('service')
|
||||||
|
if isinstance(service, compat_str):
|
||||||
|
ext_url = None
|
||||||
|
if service.lower() == 'youtube':
|
||||||
|
ext_url = external.get('code')
|
||||||
|
return self.url_result(ext_url or external['uri'])
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
video_id = compat_str(talk_info['id'])
|
video_id = compat_str(talk_info['id'])
|
||||||
|
Loading…
Reference in New Issue
Block a user