mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
[ie/tiktok] Improve error handling
Authored by: bashonly
This commit is contained in:
parent
9c3e8b1696
commit
4a4aabe374
1 changed files with 13 additions and 0 deletions
|
@ -249,6 +249,19 @@ def _extract_web_data_and_status(self, url, video_id, fatal=True):
|
||||||
elif fatal:
|
elif fatal:
|
||||||
raise ExtractorError('Unable to extract webpage video data')
|
raise ExtractorError('Unable to extract webpage video data')
|
||||||
|
|
||||||
|
if not video_data.get('video'):
|
||||||
|
msg = None
|
||||||
|
if traverse_obj(video_data, ('isContentClassified', {bool})):
|
||||||
|
msg = 'This post may not be comfortable for some audiences. Log in for access'
|
||||||
|
elif traverse_obj(video_data, (
|
||||||
|
('secret', 'forFriend', 'privateItem'), {bool}, {lambda x: x is True or None}, any),
|
||||||
|
):
|
||||||
|
msg = 'You do not have permission to view this post. Log into an account that has access'
|
||||||
|
if msg and fatal:
|
||||||
|
self.raise_login_required(msg)
|
||||||
|
elif msg:
|
||||||
|
self.report_warning(msg, video_id=video_id)
|
||||||
|
|
||||||
return video_data, status
|
return video_data, status
|
||||||
|
|
||||||
def _get_subtitles(self, aweme_detail, aweme_id, user_name):
|
def _get_subtitles(self, aweme_detail, aweme_id, user_name):
|
||||||
|
|
Loading…
Reference in a new issue