From b428754fa92ee50a2cef2ddbab019958026f88db Mon Sep 17 00:00:00 2001 From: dirkf Date: Fri, 7 Jan 2022 03:18:30 +0000 Subject: [PATCH] Resurrect TikTokUserIE --- youtube_dl/extractor/tiktok.py | 37 +++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/tiktok.py b/youtube_dl/extractor/tiktok.py index 30130b0ac..99a0c07d7 100644 --- a/youtube_dl/extractor/tiktok.py +++ b/youtube_dl/extractor/tiktok.py @@ -127,11 +127,6 @@ class TikTokIE(TikTokBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - # dummy request to set cookies - self._request_webpage( - HEADRequest(url), video_id, - note=False, errnote='Could not send HEAD request to %s' % url, - fatal=False) webpage = self._download_webpage(url, video_id) page_props = self._parse_json(self._search_regex( @@ -162,7 +157,6 @@ class TikTokUserIE(TikTokBaseIE): }, 'playlist_mincount': 24, }] - _WORKING = False @classmethod def suitable(cls, url): @@ -170,10 +164,38 @@ class TikTokUserIE(TikTokBaseIE): def _real_extract(self, url): user_id = self._match_id(url) + + webpage = self._download_webpage(url, user_id) + page_props = self._parse_json(self._search_regex( + r'''(?s)]*?\bid\s*=\s*(?P"|'|\b)sigi-persisted-data(?P=q)[^>]*>[^=]*=\s*(?P{.+?})\s*(?:;[^<]+)?