From 49895f062ed0b47061e7d2b3cdd5a322650f32c3 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 14 Feb 2022 02:56:03 +0530 Subject: [PATCH] [tiktok] Fix `vt.tiktok` URLs and add test --- yt_dlp/extractor/extractors.py | 2 +- yt_dlp/extractor/tiktok.py | 31 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 1ab298d99..3adef0fff 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -1613,7 +1613,7 @@ from .tiktok import ( TikTokSoundIE, TikTokEffectIE, TikTokTagIE, - TiktokVMIE, + TikTokVMIE, DouyinIE, ) from .tinypic import TinyPicIE diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index 489947d04..620973a9f 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -820,10 +820,37 @@ class DouyinIE(TikTokIE): traverse_obj(render_data, (..., 'aweme', 'detail'), get_all=False), url) -class TiktokVMIE(InfoExtractor): - _VALID_URL = r'https?://vm.tiktok.com/(?P\w+)' +class TikTokVMIE(InfoExtractor): + _VALID_URL = r'https?://(?:vm|vt)\.tiktok\.com/(?P\w+)' 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): return self.url_result(self._request_webpage( HEADRequest(url), self._match_id(url), headers={'User-Agent': 'facebookexternalhit/1.1'}).geturl(), TikTokIE)