From bf3d82bd4b11e6ef06634c04d2bbb68593025984 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Tue, 21 May 2024 23:59:39 +0200 Subject: [PATCH] [tiktok] fix extraction --- src/you_get/extractors/tiktok.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/you_get/extractors/tiktok.py b/src/you_get/extractors/tiktok.py index 2c4892f629..3cbb59d347 100644 --- a/src/you_get/extractors/tiktok.py +++ b/src/you_get/extractors/tiktok.py @@ -27,12 +27,12 @@ def tiktok_download(url, output_dir='.', merge=True, info_only=False, **kwargs): tt_chain_token = r1('tt_chain_token=([^;]+);', set_cookie) headers['Cookie'] = 'tt_chain_token=%s' % tt_chain_token - data = r1(r'window\[\'SIGI_STATE\'\]=(.*?);window\[\'SIGI_RETRY\'\]', html) or \ - r1(r'', html) + data = r1(r'', html) info = json.loads(data) - downloadAddr = info['ItemModule'][vid]['video']['downloadAddr'] - author = info['ItemModule'][vid]['author'] # same as uniqueId - nickname = info['UserModule']['users'][author]['nickname'] + itemStruct = info['__DEFAULT_SCOPE__']['webapp.video-detail']['itemInfo']['itemStruct'] + downloadAddr = itemStruct['video']['downloadAddr'] + author = itemStruct['author']['uniqueId'] + nickname = itemStruct['author']['nickname'] title = '%s [%s]' % (nickname or author, vid) mime, ext, size = url_info(downloadAddr, headers=headers)