[ie/zaiko] Improve thumbnail extraction (#8054)

Authored by: pzhlkj6612
This commit is contained in:
Mozi 2023-09-17 05:04:10 +08:00 committed by GitHub
parent a83da3717d
commit ecef42c3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,7 @@ from ..utils import (
traverse_obj,
try_call,
unescapeHTML,
url_basename,
url_or_none,
)
@ -45,12 +46,14 @@ class ZaikoIE(ZaikoBaseIE):
'uploader_id': '454',
'uploader': 'ZAIKO ZERO',
'release_timestamp': 1583809200,
'thumbnail': r're:https://[a-z0-9]+.cloudfront.net/[a-z0-9_]+/[a-z0-9_]+',
'thumbnail': r're:^https://[\w.-]+/\w+/\w+',
'thumbnails': 'maxcount:2',
'release_date': '20200310',
'categories': ['Tech House'],
'live_status': 'was_live',
},
'params': {'skip_download': 'm3u8'},
'skip': 'Your account does not have tickets to this event',
}]
def _real_extract(self, url):
@ -83,6 +86,12 @@ class ZaikoIE(ZaikoBaseIE):
if not formats:
self.raise_no_formats(msg, expected=expected)
thumbnail_urls = [
traverse_obj(player_meta, ('initial_event_info', 'poster_url')),
self._og_search_thumbnail(self._download_webpage(
f'https://zaiko.io/event/{video_id}', video_id, 'Downloading event page', fatal=False) or ''),
]
return {
'id': video_id,
'formats': formats,
@ -96,8 +105,8 @@ class ZaikoIE(ZaikoBaseIE):
}),
**traverse_obj(player_meta, ('initial_event_info', {
'alt_title': ('title', {str}),
'thumbnail': ('poster_url', {url_or_none}),
})),
'thumbnails': [{'url': url, 'id': url_basename(url)} for url in thumbnail_urls if url_or_none(url)]
}