diff options
author | Remita Amine <[email protected]> | 2021-03-21 09:10:38 +0100 |
---|---|---|
committer | Remita Amine <[email protected]> | 2021-03-21 09:10:38 +0100 |
commit | 21ccd0d7f46002acc61eb21bd0d4e492064c7fe1 (patch) | |
tree | 579b4361c95e571b978fc83f2720a91a2a51d4d7 | |
parent | 7e79ba7dd6e6649dd2ce3a74004b2044f2182881 (diff) | |
download | youtube-dl-21ccd0d7f46002acc61eb21bd0d4e492064c7fe1.tar.gz youtube-dl-21ccd0d7f46002acc61eb21bd0d4e492064c7fe1.zip |
[tiktok] detect private videos(closes #28453)
-rw-r--r-- | youtube_dl/extractor/tiktok.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/extractor/tiktok.py b/youtube_dl/extractor/tiktok.py index ea1beb8af..4faa6de54 100644 --- a/youtube_dl/extractor/tiktok.py +++ b/youtube_dl/extractor/tiktok.py @@ -107,9 +107,12 @@ class TikTokIE(TikTokBaseIE): def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - data = self._parse_json(self._search_regex( + page_props = self._parse_json(self._search_regex( r'<script[^>]+\bid=["\']__NEXT_DATA__[^>]+>\s*({.+?})\s*</script', - webpage, 'data'), video_id)['props']['pageProps']['itemInfo']['itemStruct'] + webpage, 'data'), video_id)['props']['pageProps'] + data = try_get(page_props, lambda x: x['itemInfo']['itemStruct'], dict) + if not data and page_props.get('statusCode') == 10216: + raise ExtractorError('This video is private', expected=True) return self._extract_video(data, video_id) |