[tiktok] fix extraction for alternative URLs

This commit is contained in:
Mort Yao 2022-08-25 15:36:11 +02:00
parent 5e25e1b5e2
commit fd5e313097
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -15,9 +15,7 @@ def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
m = re.match('(https?://)?([^/]+)(/.*)', url)
host = m.group(2)
if host != 'www.tiktok.com': # non-canonical URL
html = getHttps(host, url, headers=headers, gzip=False)
url = r1(r'(https://www.tiktok.com/[^?"]+)', html)
# use canonical URL
url = get_location(url, headers=headers)
m = re.match('(https?://)?([^/]+)(/.*)', url)
host = m.group(2)