From 88afe05695464e4242933b9474eaf2b15f8b55bb Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 13 Feb 2022 20:11:03 +0530 Subject: [PATCH] [tiktok] Fix `vm.tiktok` URLs Closes #2396 --- yt_dlp/extractor/extractors.py | 1 + yt_dlp/extractor/tiktok.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 6af32451f..1ab298d99 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -1613,6 +1613,7 @@ TikTokSoundIE, TikTokEffectIE, TikTokTagIE, + TiktokVMIE, DouyinIE, ) from .tinypic import TinyPicIE diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index 4150c3ff3..489947d04 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -14,6 +14,7 @@ ) from ..utils import ( ExtractorError, + HEADRequest, int_or_none, join_nonempty, LazyList, @@ -817,3 +818,12 @@ def _real_extract(self, url): render_data_json, video_id, transform_source=compat_urllib_parse_unquote) return self._parse_aweme_video_web( traverse_obj(render_data, (..., 'aweme', 'detail'), get_all=False), url) + + +class TiktokVMIE(InfoExtractor): + _VALID_URL = r'https?://vm.tiktok.com/(?P\w+)' + IE_NAME = 'vm.tiktok' + + 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)