diff --git a/src/you_get/extractors/tiktok.py b/src/you_get/extractors/tiktok.py index 3cbb59d3..d1d98c41 100644 --- a/src/you_get/extractors/tiktok.py +++ b/src/you_get/extractors/tiktok.py @@ -16,6 +16,8 @@ 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 + if host == 'vt.tiktok.com': # short URL + url = get_location(url) vid = r1(r'/video/(\d+)', url) url = 'https://www.tiktok.com/@/video/%s/' % vid host = 'www.tiktok.com' diff --git a/tests/test.py b/tests/test.py index 8d348fbc..f04b1fe2 100644 --- a/tests/test.py +++ b/tests/test.py @@ -57,12 +57,14 @@ class YouGetTests(unittest.TestCase): #) def test_tiktok(self): - tiktok.download('https://www.tiktok.com/@nmb48_official/video/6850796940293164290', info_only=True) - tiktok.download('https://www.tiktok.com/@/video/6850796940293164290', info_only=True) - tiktok.download('https://t.tiktok.com/i18n/share/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/7398162058153315605', 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): 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): miaopai.download('https://video.weibo.com/show?fid=1034:4825403706245135', info_only=True)