mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 02:37:29 +01:00
parent
8157a09d22
commit
487c5b3389
@ -16,6 +16,7 @@
|
|||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
|
dict_get,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
@ -577,11 +578,20 @@ def build_format_id(kind):
|
|||||||
if duration is not None and duration <= 0:
|
if duration is not None and duration <= 0:
|
||||||
is_live = True
|
is_live = True
|
||||||
|
|
||||||
|
common_res = [(160, 90), (320, 180), (480, 720), (640, 360), (768, 432), (1024, 576), (1280, 720), (1366, 768), (1920, 1080)]
|
||||||
|
thumb_base_url = dict_get(json_data, ('poster', 'thumbnail'))
|
||||||
|
thumbnails = [{
|
||||||
|
'url': re.sub(r'\d+x\d+', f'{w}x{h}', thumb_base_url),
|
||||||
|
'width': w,
|
||||||
|
'height': h,
|
||||||
|
} for w, h in common_res] if thumb_base_url else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': self._live_title(title) if is_live else title,
|
||||||
'description': clean_html(json_data.get('description')),
|
'description': clean_html(json_data.get('description')),
|
||||||
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
|
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
|
||||||
|
'thumbnials': thumbnails,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'timestamp': parse_iso8601(json_data.get('published_at')),
|
'timestamp': parse_iso8601(json_data.get('published_at')),
|
||||||
'uploader_id': json_data.get('account_id'),
|
'uploader_id': json_data.get('account_id'),
|
||||||
|
Loading…
Reference in New Issue
Block a user