mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-01 07:50:30 +01:00
[ie/tiktok] Improve error handling (#12445)
Closes #8678 Authored by: bashonly
This commit is contained in:
parent
6deeda5c11
commit
99ea297875
@ -249,6 +249,12 @@ class TikTokBaseIE(InfoExtractor):
|
||||
elif fatal:
|
||||
raise ExtractorError('Unable to extract webpage video data')
|
||||
|
||||
if not traverse_obj(video_data, ('video', {dict})) and traverse_obj(video_data, ('isContentClassified', {bool})):
|
||||
message = 'This post may not be comfortable for some audiences. Log in for access'
|
||||
if fatal:
|
||||
self.raise_login_required(message)
|
||||
self.report_warning(f'{message}. {self._login_hint()}', video_id=video_id)
|
||||
|
||||
return video_data, status
|
||||
|
||||
def _get_subtitles(self, aweme_detail, aweme_id, user_name):
|
||||
@ -895,8 +901,12 @@ class TikTokIE(TikTokBaseIE):
|
||||
|
||||
if video_data and status == 0:
|
||||
return self._parse_aweme_video_web(video_data, url, video_id)
|
||||
elif status == 10216:
|
||||
raise ExtractorError('This video is private', expected=True)
|
||||
elif status in (10216, 10222):
|
||||
# 10216: private post; 10222: private account
|
||||
self.raise_login_required(
|
||||
'You do not have permission to view this post. Log into an account that has access')
|
||||
elif status == 10204:
|
||||
raise ExtractorError('Your IP address is blocked from accessing this post', expected=True)
|
||||
raise ExtractorError(f'Video not available, status code {status}', video_id=video_id)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user