[pornhub] Detect flagged videos
authorSergey M․ <dstftw@gmail.com>
Tue, 9 Mar 2021 19:56:01 +0000 (02:56 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 9 Mar 2021 19:56:01 +0000 (02:56 +0700)
youtube_dl/extractor/pornhub.py

index fdf8b1b0ddc84caa71ff1be5ebf136cd0f5414bc..2a7818e41bcc63ae1876f350e28c4e1c14732c88 100644 (file)
@@ -167,6 +167,7 @@ class PornHubIE(PornHubBaseIE):
         'params': {
             'skip_download': True,
         },
+        'skip': 'Video has been flagged for verification in accordance with our trust and safety policy',
     }, {
         # subtitles
         'url': 'https://www.pornhub.com/view_video.php?viewkey=ph5af5fef7c2aa7',
@@ -265,7 +266,8 @@ class PornHubIE(PornHubBaseIE):
         webpage = dl_webpage('pc')
 
         error_msg = self._html_search_regex(
-            r'(?s)<div[^>]+class=(["\'])(?:(?!\1).)*\b(?:removed|userMessageSection)\b(?:(?!\1).)*\1[^>]*>(?P<error>.+?)</div>',
+            (r'(?s)<div[^>]+class=(["\'])(?:(?!\1).)*\b(?:removed|userMessageSection)\b(?:(?!\1).)*\1[^>]*>(?P<error>.+?)</div>',
+             r'(?s)<section[^>]+class=["\']noVideo["\'][^>]*>(?P<error>.+?)</section>'),
             webpage, 'error message', default=None, group='error')
         if error_msg:
             error_msg = re.sub(r'\s+', ' ', error_msg)