From 7bbc0bbce02e5b5a1beb08c9464c91eab537652a Mon Sep 17 00:00:00 2001 From: GreyAlien502 Date: Mon, 26 Oct 2020 12:38:25 +0000 Subject: [PATCH 1/2] fix tiktok download --- youtube_dlc/extractor/tiktok.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/youtube_dlc/extractor/tiktok.py b/youtube_dlc/extractor/tiktok.py index 0cfd2168a..997a89e01 100644 --- a/youtube_dlc/extractor/tiktok.py +++ b/youtube_dlc/extractor/tiktok.py @@ -133,6 +133,8 @@ class TikTokIE(TikTokBaseIE): def _real_extract(self, url): video_id = self._match_id(url) + # If we only call once, we get a 403 when downlaoding the video. + webpage = self._download_webpage(url, video_id, note='Downloading video webpage') webpage = self._download_webpage(url, video_id, note='Downloading video webpage') json_string = self._search_regex( r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P[^<]+)', From 61e76c1e5fc6df3ebb4f728c5cc999349d36c55d Mon Sep 17 00:00:00 2001 From: GreyAlien502 Date: Tue, 27 Oct 2020 02:20:18 +0000 Subject: [PATCH 2/2] simplify second page fetch Co-authored-by: Merval --- youtube_dlc/extractor/tiktok.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dlc/extractor/tiktok.py b/youtube_dlc/extractor/tiktok.py index 997a89e01..0f2b4acae 100644 --- a/youtube_dlc/extractor/tiktok.py +++ b/youtube_dlc/extractor/tiktok.py @@ -134,7 +134,7 @@ def _real_extract(self, url): video_id = self._match_id(url) # If we only call once, we get a 403 when downlaoding the video. - webpage = self._download_webpage(url, video_id, note='Downloading video webpage') + self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id, note='Downloading video webpage') json_string = self._search_regex( r'id=\"__NEXT_DATA__\"\s+type=\"application\/json\"\s*[^>]+>\s*(?P[^<]+)',