mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 10:07:43 -05:00
[ie/tiktok] Fix web formats extraction (#11074)
Closes #11034 Authored by: bashonly
This commit is contained in:
parent
4a9bc8c363
commit
3ad0b7f422
@ -542,16 +542,12 @@ class TikTokBaseIE(InfoExtractor):
|
|||||||
**COMMON_FORMAT_INFO,
|
**COMMON_FORMAT_INFO,
|
||||||
'format_id': 'download',
|
'format_id': 'download',
|
||||||
'url': self._proto_relative_url(download_url),
|
'url': self._proto_relative_url(download_url),
|
||||||
|
'format_note': 'watermarked',
|
||||||
|
'preference': -2,
|
||||||
})
|
})
|
||||||
|
|
||||||
self._remove_duplicate_formats(formats)
|
self._remove_duplicate_formats(formats)
|
||||||
|
|
||||||
for f in traverse_obj(formats, lambda _, v: 'unwatermarked' not in v['url']):
|
|
||||||
f.update({
|
|
||||||
'format_note': join_nonempty(f.get('format_note'), 'watermarked', delim=', '),
|
|
||||||
'preference': f.get('preference') or -2,
|
|
||||||
})
|
|
||||||
|
|
||||||
# Is it a slideshow with only audio for download?
|
# Is it a slideshow with only audio for download?
|
||||||
if not formats and traverse_obj(aweme_detail, ('music', 'playUrl', {url_or_none})):
|
if not formats and traverse_obj(aweme_detail, ('music', 'playUrl', {url_or_none})):
|
||||||
audio_url = aweme_detail['music']['playUrl']
|
audio_url = aweme_detail['music']['playUrl']
|
||||||
@ -565,7 +561,8 @@ class TikTokBaseIE(InfoExtractor):
|
|||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
return formats
|
# Filter out broken formats, see https://github.com/yt-dlp/yt-dlp/issues/11034
|
||||||
|
return [f for f in formats if urllib.parse.urlparse(f['url']).hostname != 'www.tiktok.com']
|
||||||
|
|
||||||
def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id, extract_flat=False):
|
def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id, extract_flat=False):
|
||||||
author_info = traverse_obj(aweme_detail, (('authorInfo', 'author', None), {
|
author_info = traverse_obj(aweme_detail, (('authorInfo', 'author', None), {
|
||||||
|
Loading…
Reference in New Issue
Block a user