mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
[tiktok] improve regexp
This commit is contained in:
parent
e2217bedd2
commit
95d6d2e570
@ -6,10 +6,10 @@ from ..common import *
|
|||||||
|
|
||||||
def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||||
while True:
|
while True:
|
||||||
m = re.match('https://([^/]+)(/.*)', url)
|
m = re.match('(https?://)?([^/]+)(/.*)', url)
|
||||||
host = m.group(1)
|
host = m.group(2)
|
||||||
if host == 'www.tiktok.com': # canonical URL reached
|
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
|
vid = url.split('/')[3] # should be a string of numbers
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user