mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-22 02:15:12 +00:00
[TikTok] Fix URLs with user id (#3295)
Closes #3243 Authored by: hatienl0i261299
This commit is contained in:
parent
04f3fd2c89
commit
5fa3c9a88f
1 changed files with 35 additions and 2 deletions
|
@ -263,7 +263,7 @@ def extract_addr(addr, add_meta={}):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': aweme_id,
|
'id': aweme_id,
|
||||||
'title': aweme_detail['desc'],
|
'title': aweme_detail.get('desc'),
|
||||||
'description': aweme_detail['desc'],
|
'description': aweme_detail['desc'],
|
||||||
'view_count': int_or_none(stats_info.get('play_count')),
|
'view_count': int_or_none(stats_info.get('play_count')),
|
||||||
'like_count': int_or_none(stats_info.get('digg_count')),
|
'like_count': int_or_none(stats_info.get('digg_count')),
|
||||||
|
@ -457,6 +457,30 @@ class TikTokIE(TikTokBaseIE):
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
},
|
},
|
||||||
'expected_warnings': ['Video not available']
|
'expected_warnings': ['Video not available']
|
||||||
|
}, {
|
||||||
|
# Video without title and description
|
||||||
|
'url': 'https://www.tiktok.com/@pokemonlife22/video/7059698374567611694',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '7059698374567611694',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'N/A',
|
||||||
|
'description': '',
|
||||||
|
'uploader': 'pokemonlife22',
|
||||||
|
'creator': 'Pokemon',
|
||||||
|
'uploader_id': '6820838815978423302',
|
||||||
|
'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAA0tF1nBwQVVMyrGu3CqttkNgM68Do1OXUFuCY0CRQk8fEtSVDj89HqoqvbSTmUP2W',
|
||||||
|
'track': 'original sound',
|
||||||
|
'timestamp': 1643714123,
|
||||||
|
'duration': 6,
|
||||||
|
'thumbnail': r're:^https?://[\w\/\.\-]+(~[\w\-]+\.image)?',
|
||||||
|
'upload_date': '20220201',
|
||||||
|
'artist': 'Pokemon',
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'repost_count': int,
|
||||||
|
'comment_count': int,
|
||||||
|
},
|
||||||
|
'expected_warnings': ['Video not available']
|
||||||
}, {
|
}, {
|
||||||
# Auto-captions available
|
# Auto-captions available
|
||||||
'url': 'https://www.tiktok.com/@hankgreen1/video/7047596209028074758',
|
'url': 'https://www.tiktok.com/@hankgreen1/video/7047596209028074758',
|
||||||
|
@ -521,6 +545,15 @@ class TikTokUserIE(TikTokBaseIE):
|
||||||
'thumbnail': r're:https://.+_1080x1080\.webp'
|
'thumbnail': r're:https://.+_1080x1080\.webp'
|
||||||
},
|
},
|
||||||
'expected_warnings': ['Retrying']
|
'expected_warnings': ['Retrying']
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.tiktok.com/@6820838815978423302',
|
||||||
|
'playlist_mincount': 5,
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6820838815978423302',
|
||||||
|
'title': '6820838815978423302',
|
||||||
|
'thumbnail': r're:https://.+_1080x1080\.webp'
|
||||||
|
},
|
||||||
|
'expected_warnings': ['Retrying']
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.tiktok.com/@meme',
|
'url': 'https://www.tiktok.com/@meme',
|
||||||
'playlist_mincount': 593,
|
'playlist_mincount': 593,
|
||||||
|
@ -593,7 +626,7 @@ def _real_extract(self, url):
|
||||||
webpage = self._download_webpage(url, user_name, headers={
|
webpage = self._download_webpage(url, user_name, headers={
|
||||||
'User-Agent': 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
'User-Agent': 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
||||||
})
|
})
|
||||||
user_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, 'user ID')
|
user_id = self._html_search_regex(r'snssdk\d*://user/profile/(\d+)', webpage, 'user ID', default=None) or user_name
|
||||||
|
|
||||||
videos = LazyList(self._video_entries_api(webpage, user_id, user_name))
|
videos = LazyList(self._video_entries_api(webpage, user_id, user_name))
|
||||||
thumbnail = traverse_obj(videos, (0, 'author', 'avatar_larger', 'url_list', 0))
|
thumbnail = traverse_obj(videos, (0, 'author', 'avatar_larger', 'url_list', 0))
|
||||||
|
|
Loading…
Reference in a new issue