Skip to content

Commit

Permalink
[pornhub] Detect flagged videos
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Mar 9, 2021
1 parent 7dc5134 commit 1a1ccd9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion youtube_dl/extractor/pornhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -265,7 +266,8 @@ def dl_webpage(platform):
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)
Expand Down

0 comments on commit 1a1ccd9

Please sign in to comment.