From 11e1c2e3f8092f2d1059bf7265f093595198ef20 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 8 Apr 2022 14:46:05 +0530 Subject: [PATCH] [TikTokVM] Fix redirect to user URL Closes #3349, Closes #3351 --- yt_dlp/extractor/tiktok.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index c1d6c5477..987b0c43b 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -15,6 +15,7 @@ from ..compat import ( from ..utils import ( ExtractorError, HEADRequest, + UnsupportedError, get_first, int_or_none, join_nonempty, @@ -890,5 +891,8 @@ class TikTokVMIE(InfoExtractor): }] 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) + new_url = self._request_webpage( + HEADRequest(url), self._match_id(url), headers={'User-Agent': 'facebookexternalhit/1.1'}).geturl() + if self.suitable(new_url): # Prevent infinite loop in case redirect fails + raise UnsupportedError(new_url) + return self.url_result(new_url)