diff options
author | Sergey M․ <[email protected]> | 2021-05-30 03:05:22 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2021-05-30 03:05:22 +0700 |
commit | 6511b8e8d7db78d4ba3706df5122a74e1c9b9b57 (patch) | |
tree | 32c159d8d2d24d910359e2b139e1500bf3e2168e | |
parent | f3cd1d9cec91943a459a0662cbcffe3b2e1f6675 (diff) | |
download | youtube-dl-6511b8e8d7db78d4ba3706df5122a74e1c9b9b57.tar.gz youtube-dl-6511b8e8d7db78d4ba3706df5122a74e1c9b9b57.zip |
[ted] Prefer own formats over external sources (closes #29142)
-rw-r--r-- | youtube_dl/extractor/ted.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/youtube_dl/extractor/ted.py b/youtube_dl/extractor/ted.py index 63e2455b2..f09f1a3f9 100644 --- a/youtube_dl/extractor/ted.py +++ b/youtube_dl/extractor/ted.py @@ -123,6 +123,10 @@ class TEDIE(InfoExtractor): 'params': { '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 = { @@ -210,16 +214,6 @@ class TEDIE(InfoExtractor): 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') http_url = None @@ -294,6 +288,16 @@ class TEDIE(InfoExtractor): '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) video_id = compat_str(talk_info['id']) |