[TikTokVM] Fix redirect to user URL

Closes #3349, Closes #3351
This commit is contained in:
pukkandan 2022-04-08 14:46:05 +05:30
parent ebc7d3ff1f
commit 11e1c2e3f8
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39

View file

@ -15,6 +15,7 @@
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
HEADRequest, HEADRequest,
UnsupportedError,
get_first, get_first,
int_or_none, int_or_none,
join_nonempty, join_nonempty,
@ -890,5 +891,8 @@ class TikTokVMIE(InfoExtractor):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
return self.url_result(self._request_webpage( new_url = 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()
if self.suitable(new_url): # Prevent infinite loop in case redirect fails
raise UnsupportedError(new_url)
return self.url_result(new_url)