1
0
Fork 0
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:
bashonly 2025-02-22 16:43:42 -06:00
parent 9c3e8b1696
commit 4a4aabe374
No known key found for this signature in database
GPG key ID: 783F096F253D15B0

View file

@ -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):