[tiktok] detect login page redirects (#7716)

This commit is contained in:
Mike Fährmann
2025-06-22 13:14:59 +02:00
parent 68960e29a1
commit 9c9eb7a3bb

View File

@@ -104,7 +104,12 @@ class TiktokExtractor(Extractor):
tries = 0
while True:
try:
html = self.request(url).text
response = self.request(url)
if response.history and "/login" in response.url:
raise exception.AuthorizationError(
"HTTP redirect to login page "
f"('{response.url.partition('?')[0]}')")
html = response.text
data = text.extr(
html, '<script id="__UNIVERSAL_DATA_FOR_REHYDRATION__" '
'type="application/json">', '</script>')