From 95d6d2e570bdd5b43bd55a758ac31ede2b5d298c Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Fri, 29 Apr 2022 23:23:59 +0200 Subject: [PATCH] [tiktok] improve regexp --- src/you_get/extractors/tiktok.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/you_get/extractors/tiktok.py b/src/you_get/extractors/tiktok.py index 33e1f11e..50780ac1 100644 --- a/src/you_get/extractors/tiktok.py +++ b/src/you_get/extractors/tiktok.py @@ -6,10 +6,10 @@ from ..common import * def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs): while True: - m = re.match('https://([^/]+)(/.*)', url) - host = m.group(1) + m = re.match('(https?://)?([^/]+)(/.*)', url) + host = m.group(2) if host == 'www.tiktok.com': # canonical URL reached - url = m.group(2).split('?')[0] + url = m.group(3).split('?')[0] vid = url.split('/')[3] # should be a string of numbers break else: