mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 08:26:50 +00:00
[ndr:base:embed] Improve thumbnails extraction (closes #23731)
This commit is contained in:
parent
bd2c211fcc
commit
3fc56635b7
@ -9,6 +9,8 @@ from ..utils import (
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
qualities,
|
qualities,
|
||||||
|
try_get,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -220,11 +222,17 @@ class NDREmbedBaseIE(InfoExtractor):
|
|||||||
upload_date = ppjson.get('config', {}).get('publicationDate')
|
upload_date = ppjson.get('config', {}).get('publicationDate')
|
||||||
duration = int_or_none(config.get('duration'))
|
duration = int_or_none(config.get('duration'))
|
||||||
|
|
||||||
thumbnails = [{
|
thumbnails = []
|
||||||
'id': thumbnail.get('quality') or thumbnail_id,
|
poster = try_get(config, lambda x: x['poster'], dict) or {}
|
||||||
'url': thumbnail['src'],
|
for thumbnail_id, thumbnail in poster.items():
|
||||||
'preference': quality_key(thumbnail.get('quality')),
|
thumbnail_url = urljoin(url, thumbnail.get('src'))
|
||||||
} for thumbnail_id, thumbnail in config.get('poster', {}).items() if 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 {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user