mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-11 07:26:10 +01:00
[ie/tiktok] Deprioritize animated thumbnails (#11645)
Closes #11641 Authored by: bashonly
This commit is contained in:
parent
0a0d80800b
commit
910ecc4229
@ -413,15 +413,6 @@ def extract_addr(addr, add_meta={}):
|
|||||||
for f in formats:
|
for f in formats:
|
||||||
self._set_cookie(urllib.parse.urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value)
|
self._set_cookie(urllib.parse.urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value)
|
||||||
|
|
||||||
thumbnails = []
|
|
||||||
for cover_id in ('cover', 'ai_dynamic_cover', 'animated_cover', 'ai_dynamic_cover_bak',
|
|
||||||
'origin_cover', 'dynamic_cover'):
|
|
||||||
for cover_url in traverse_obj(video_info, (cover_id, 'url_list', ...)):
|
|
||||||
thumbnails.append({
|
|
||||||
'id': cover_id,
|
|
||||||
'url': cover_url,
|
|
||||||
})
|
|
||||||
|
|
||||||
stats_info = aweme_detail.get('statistics') or {}
|
stats_info = aweme_detail.get('statistics') or {}
|
||||||
music_info = aweme_detail.get('music') or {}
|
music_info = aweme_detail.get('music') or {}
|
||||||
labels = traverse_obj(aweme_detail, ('hybrid_label', ..., 'text'), expected_type=str)
|
labels = traverse_obj(aweme_detail, ('hybrid_label', ..., 'text'), expected_type=str)
|
||||||
@ -467,7 +458,17 @@ def extract_addr(addr, add_meta={}):
|
|||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': self.extract_subtitles(
|
'subtitles': self.extract_subtitles(
|
||||||
aweme_detail, aweme_id, traverse_obj(author_info, 'uploader', 'uploader_id', 'channel_id')),
|
aweme_detail, aweme_id, traverse_obj(author_info, 'uploader', 'uploader_id', 'channel_id')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': [
|
||||||
|
{
|
||||||
|
'id': cover_id,
|
||||||
|
'url': cover_url,
|
||||||
|
'preference': -1 if cover_id in ('cover', 'origin_cover') else -2,
|
||||||
|
}
|
||||||
|
for cover_id in (
|
||||||
|
'cover', 'ai_dynamic_cover', 'animated_cover',
|
||||||
|
'ai_dynamic_cover_bak', 'origin_cover', 'dynamic_cover')
|
||||||
|
for cover_url in traverse_obj(video_info, (cover_id, 'url_list', ...))
|
||||||
|
],
|
||||||
'duration': (traverse_obj(video_info, (
|
'duration': (traverse_obj(video_info, (
|
||||||
(None, 'download_addr'), 'duration', {int_or_none(scale=1000)}, any))
|
(None, 'download_addr'), 'duration', {int_or_none(scale=1000)}, any))
|
||||||
or traverse_obj(music_info, ('duration', {int_or_none}))),
|
or traverse_obj(music_info, ('duration', {int_or_none}))),
|
||||||
@ -600,11 +601,15 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id, extract_fl
|
|||||||
'repost_count': 'shareCount',
|
'repost_count': 'shareCount',
|
||||||
'comment_count': 'commentCount',
|
'comment_count': 'commentCount',
|
||||||
}), expected_type=int_or_none),
|
}), expected_type=int_or_none),
|
||||||
'thumbnails': traverse_obj(aweme_detail, (
|
'thumbnails': [
|
||||||
(None, 'video'), ('thumbnail', 'cover', 'dynamicCover', 'originCover'), {
|
{
|
||||||
'url': ({url_or_none}, {self._proto_relative_url}),
|
'id': cover_id,
|
||||||
},
|
'url': self._proto_relative_url(cover_url),
|
||||||
)),
|
'preference': -2 if cover_id == 'dynamicCover' else -1,
|
||||||
|
}
|
||||||
|
for cover_id in ('thumbnail', 'cover', 'dynamicCover', 'originCover')
|
||||||
|
for cover_url in traverse_obj(aweme_detail, ((None, 'video'), cover_id, {url_or_none}))
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user