Skip to content

Commit

Permalink
[redtube] Detect private videos (#23518)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and pareronia committed Jun 22, 2020
1 parent d0d7215 commit c97d03b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions youtube_dl/extractor/redtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ def _real_extract(self, url):
webpage = self._download_webpage(
'http://www.redtube.com/%s' % video_id, video_id)

if any(s in webpage for s in ['video-deleted-info', '>This video has been removed']):
raise ExtractorError('Video %s has been removed' % video_id, expected=True)
ERRORS = (
(('video-deleted-info', '>This video has been removed'), 'has been removed'),
(('private_video_text', '>This video is private', '>Send a friend request to its owner to be able to view it'), 'is private'),
)

for patterns, message in ERRORS:
if any(p in webpage for p in patterns):
raise ExtractorError(
'Video %s %s' % (video_id, message), expected=True)

info = self._search_json_ld(webpage, video_id, default={})

Expand Down

0 comments on commit c97d03b

Please sign in to comment.