aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-01-14 21:46:56 +0700
committerSergey M․ <dstftw@gmail.com>2020-01-14 21:46:56 +0700
commit3fc56635b7d375b262ac3c15aaae549227b5227e (patch)
treebd9166d71dd8b550d40204af994b529d9ecc0749 /youtube_dl/extractor
parentbd2c211fcc3b0390a1b404fa01409d455859caa8 (diff)
[ndr:base:embed] Improve thumbnails extraction (closes #23731)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/ndr.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/youtube_dl/extractor/ndr.py b/youtube_dl/extractor/ndr.py
index aec2ea133..9c8bf05af 100644
--- a/youtube_dl/extractor/ndr.py
+++ b/youtube_dl/extractor/ndr.py
@@ -9,6 +9,8 @@ from ..utils import (
int_or_none,
parse_iso8601,
qualities,
+ try_get,
+ urljoin,
)
@@ -220,11 +222,17 @@ class NDREmbedBaseIE(InfoExtractor):
upload_date = ppjson.get('config', {}).get('publicationDate')
duration = int_or_none(config.get('duration'))
- thumbnails = [{
- 'id': thumbnail.get('quality') or thumbnail_id,
- 'url': thumbnail['src'],
- 'preference': quality_key(thumbnail.get('quality')),
- } for thumbnail_id, thumbnail in config.get('poster', {}).items() if thumbnail.get('src')]
+ thumbnails = []
+ poster = try_get(config, lambda x: x['poster'], dict) or {}
+ for thumbnail_id, thumbnail in poster.items():
+ thumbnail_url = urljoin(url, thumbnail.get('src'))
+ if not thumbnail_url:
+ continue
+ thumbnails.append({
+ 'id': thumbnail.get('quality') or thumbnail_id,
+ 'url': thumbnail_url,
+ 'preference': quality_key(thumbnail.get('quality')),
+ })
return {
'id': video_id,