mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
[tiktok] support short URLs (vt.tiktok.com)
This commit is contained in:
parent
79aaec4317
commit
bc0e680ed5
@ -16,6 +16,8 @@ def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
|||||||
m = re.match('(https?://)?([^/]+)(/.*)', url)
|
m = re.match('(https?://)?([^/]+)(/.*)', url)
|
||||||
host = m.group(2)
|
host = m.group(2)
|
||||||
if host != 'www.tiktok.com': # non-canonical URL
|
if host != 'www.tiktok.com': # non-canonical URL
|
||||||
|
if host == 'vt.tiktok.com': # short URL
|
||||||
|
url = get_location(url)
|
||||||
vid = r1(r'/video/(\d+)', url)
|
vid = r1(r'/video/(\d+)', url)
|
||||||
url = 'https://www.tiktok.com/@/video/%s/' % vid
|
url = 'https://www.tiktok.com/@/video/%s/' % vid
|
||||||
host = 'www.tiktok.com'
|
host = 'www.tiktok.com'
|
||||||
|
@ -57,12 +57,14 @@ class YouGetTests(unittest.TestCase):
|
|||||||
#)
|
#)
|
||||||
|
|
||||||
def test_tiktok(self):
|
def test_tiktok(self):
|
||||||
tiktok.download('https://www.tiktok.com/@nmb48_official/video/6850796940293164290', info_only=True)
|
tiktok.download('https://www.tiktok.com/@zukky_48/video/7398162058153315605', info_only=True)
|
||||||
tiktok.download('https://www.tiktok.com/@/video/6850796940293164290', info_only=True)
|
tiktok.download('https://www.tiktok.com/@/video/7398162058153315605', info_only=True)
|
||||||
tiktok.download('https://t.tiktok.com/i18n/share/video/6850796940293164290/', info_only=True)
|
tiktok.download('https://t.tiktok.com/i18n/share/video/7398162058153315605/', info_only=True)
|
||||||
|
tiktok.download('https://vt.tiktok.com/ZSYKjKt6M/', info_only=True)
|
||||||
|
|
||||||
def test_twitter(self):
|
def test_twitter(self):
|
||||||
twitter.download('https://twitter.com/elonmusk/status/1530516552084234244', info_only=True)
|
twitter.download('https://twitter.com/elonmusk/status/1530516552084234244', info_only=True)
|
||||||
|
twitter.download('https://x.com/elonmusk/status/1530516552084234244', info_only=True)
|
||||||
|
|
||||||
def test_weibo(self):
|
def test_weibo(self):
|
||||||
miaopai.download('https://video.weibo.com/show?fid=1034:4825403706245135', info_only=True)
|
miaopai.download('https://video.weibo.com/show?fid=1034:4825403706245135', info_only=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user