[tiktok] Fix vt.tiktok URLs

and add test
This commit is contained in:
pukkandan 2022-02-14 02:56:03 +05:30
parent 60f393e48b
commit 49895f062e
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
2 changed files with 30 additions and 3 deletions

View File

@ -1613,7 +1613,7 @@
TikTokSoundIE, TikTokSoundIE,
TikTokEffectIE, TikTokEffectIE,
TikTokTagIE, TikTokTagIE,
TiktokVMIE, TikTokVMIE,
DouyinIE, DouyinIE,
) )
from .tinypic import TinyPicIE from .tinypic import TinyPicIE

View File

@ -820,10 +820,37 @@ def _real_extract(self, url):
traverse_obj(render_data, (..., 'aweme', 'detail'), get_all=False), url) traverse_obj(render_data, (..., 'aweme', 'detail'), get_all=False), url)
class TiktokVMIE(InfoExtractor): class TikTokVMIE(InfoExtractor):
_VALID_URL = r'https?://vm.tiktok.com/(?P<id>\w+)' _VALID_URL = r'https?://(?:vm|vt)\.tiktok\.com/(?P<id>\w+)'
IE_NAME = 'vm.tiktok' IE_NAME = 'vm.tiktok'
_TESTS = [{
'url': 'https://vm.tiktok.com/ZSe4FqkKd',
'info_dict': {
'id': '7023491746608712966',
'ext': 'mp4',
'title': 'md5:5607564db90271abbbf8294cca77eddd',
'description': 'md5:5607564db90271abbbf8294cca77eddd',
'duration': 11,
'upload_date': '20211026',
'uploader_id': '7007385080558846981',
'creator': 'Memes',
'artist': 'Memes',
'track': 'original sound',
'uploader': 'susmandem',
'timestamp': 1635284105,
'thumbnail': r're:https://.+\.webp.*',
'like_count': int,
'view_count': int,
'comment_count': int,
'repost_count': int,
'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAAXcNoOEOxVyBzuII_E--T0MeCrLP0ay1Sm6x_n3dluiWEoWZD0VlQOytwad4W0i0n',
}
}, {
'url': 'https://vt.tiktok.com/ZSe4FqkKd',
'only_matching': True,
}]
def _real_extract(self, url): def _real_extract(self, url):
return self.url_result(self._request_webpage( return self.url_result(self._request_webpage(
HEADRequest(url), self._match_id(url), headers={'User-Agent': 'facebookexternalhit/1.1'}).geturl(), TikTokIE) HEADRequest(url), self._match_id(url), headers={'User-Agent': 'facebookexternalhit/1.1'}).geturl(), TikTokIE)