mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-29 05:32:00 +00:00
[tiktok] detect private videos(closes #28453)
This commit is contained in:
parent
7e79ba7dd6
commit
21ccd0d7f4
1 changed files with 5 additions and 2 deletions
|
@ -107,9 +107,12 @@ class TikTokIE(TikTokBaseIE):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
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',
|
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)
|
return self._extract_video(data, video_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue