summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-01-02 22:45:42 +0700
committerSergey M․ <dstftw@gmail.com>2020-01-02 22:45:42 +0700
commit484637a9ccede2967a709d2026d29d7b61560e43 (patch)
treebf8f20437cd2b170777c5df8576fa45f36c5d25a
parentca069f68816c5da790c5745713b38c70df6abf65 (diff)
downloadyoutube-dl-484637a9ccede2967a709d2026d29d7b61560e43.tar.gz
youtube-dl-484637a9ccede2967a709d2026d29d7b61560e43.tar.xz
youtube-dl-484637a9ccede2967a709d2026d29d7b61560e43.zip
[redtube] Detect private videos (#23518)
-rw-r--r--youtube_dl/extractor/redtube.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/extractor/redtube.py b/youtube_dl/extractor/redtube.py
index 5c84028ef..b1bde1e81 100644
--- a/youtube_dl/extractor/redtube.py
+++ b/youtube_dl/extractor/redtube.py
@@ -43,8 +43,15 @@ class RedTubeIE(InfoExtractor):
         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={})