]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/pornhub.py
[downloader/hls] Fix incorrect end byte in Range HTTP header for media segments with...
[yt-dlp.git] / youtube_dl / extractor / pornhub.py
CommitLineData
6c376029 1# coding: utf-8
9933b574
PH
2from __future__ import unicode_literals
3
21fbf0f9 4import functools
34541395 5import itertools
21fbf0f9 6import operator
125cfd78 7import re
8
9from .common import InfoExtractor
1cc79574 10from ..compat import (
34541395 11 compat_HTTPError,
79367a98 12 compat_str,
278d061a 13 compat_urllib_request,
1cc79574 14)
278d061a 15from .openload import PhantomJSwrapper
1cc79574 16from ..utils import (
b8526c78 17 determine_ext,
50789175 18 ExtractorError,
ed8648a3 19 int_or_none,
0164cd5d 20 NO_DEFAULT,
8f9a477e 21 orderedSet,
e1e35d1a 22 remove_quotes,
0320ddc1 23 str_to_int,
4938c8d5 24 url_or_none,
125cfd78 25)
125cfd78 26
9933b574 27
71a1f617
S
28class PornHubBaseIE(InfoExtractor):
29 def _download_webpage_handle(self, *args, **kwargs):
30 def dl(*args, **kwargs):
31 return super(PornHubBaseIE, self)._download_webpage_handle(*args, **kwargs)
32
33 webpage, urlh = dl(*args, **kwargs)
34
35 if any(re.search(p, webpage) for p in (
36 r'<body\b[^>]+\bonload=["\']go\(\)',
37 r'document\.cookie\s*=\s*["\']RNKEY=',
38 r'document\.location\.reload\(true\)')):
39 url_or_request = args[0]
40 url = (url_or_request.get_full_url()
41 if isinstance(url_or_request, compat_urllib_request.Request)
42 else url_or_request)
43 phantom = PhantomJSwrapper(self, required_version='2.0')
44 phantom.get(url, html=webpage)
45 webpage, urlh = dl(*args, **kwargs)
46
47 return webpage, urlh
48
49
50class PornHubIE(PornHubBaseIE):
bc4b2d75
S
51 IE_DESC = 'PornHub and Thumbzilla'
52 _VALID_URL = r'''(?x)
53 https?://
54 (?:
fa9b8c66 55 (?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net))/(?:(?:view_video\.php|video/show)\?viewkey=|embed/)|
bc4b2d75
S
56 (?:www\.)?thumbzilla\.com/video/
57 )
b52c9ef1 58 (?P<id>[\da-z]+)
bc4b2d75 59 '''
360075e2 60 _TESTS = [{
9933b574 61 'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
ed8648a3 62 'md5': '1e19b41231a02eba417839222ac9d58e',
9933b574 63 'info_dict': {
249efaf4
PH
64 'id': '648719015',
65 'ext': 'mp4',
611c1dd9 66 'title': 'Seductive Indian beauty strips down and fingers her pink pussy',
ed8648a3 67 'uploader': 'Babes',
3661ebf2 68 'upload_date': '20130628',
ed8648a3
S
69 'duration': 361,
70 'view_count': int,
71 'like_count': int,
72 'dislike_count': int,
73 'comment_count': int,
74 'age_limit': 18,
6bb05b32
YCH
75 'tags': list,
76 'categories': list,
6c376029
S
77 },
78 }, {
79 # non-ASCII title
80 'url': 'http://www.pornhub.com/view_video.php?viewkey=1331683002',
81 'info_dict': {
82 'id': '1331683002',
83 'ext': 'mp4',
84 'title': '重庆婷婷女王足交',
79367a98 85 'uploader': 'Unknown',
3661ebf2 86 'upload_date': '20150213',
6c376029
S
87 'duration': 1753,
88 'view_count': int,
89 'like_count': int,
90 'dislike_count': int,
91 'comment_count': int,
92 'age_limit': 18,
6bb05b32
YCH
93 'tags': list,
94 'categories': list,
6c376029
S
95 },
96 'params': {
97 'skip_download': True,
98 },
4938c8d5
GF
99 }, {
100 # subtitles
101 'url': 'https://www.pornhub.com/view_video.php?viewkey=ph5af5fef7c2aa7',
102 'info_dict': {
103 'id': 'ph5af5fef7c2aa7',
104 'ext': 'mp4',
105 'title': 'BFFS - Cute Teen Girls Share Cock On the Floor',
106 'uploader': 'BFFs',
107 'duration': 622,
108 'view_count': int,
109 'like_count': int,
110 'dislike_count': int,
111 'comment_count': int,
112 'age_limit': 18,
113 'tags': list,
114 'categories': list,
115 'subtitles': {
116 'en': [{
117 "ext": 'srt'
118 }]
119 },
120 },
121 'params': {
122 'skip_download': True,
123 },
360075e2
S
124 }, {
125 'url': 'http://www.pornhub.com/view_video.php?viewkey=ph557bbb6676d2d',
126 'only_matching': True,
272e4db5 127 }, {
eaaaaec0 128 # removed at the request of cam4.com
272e4db5
S
129 'url': 'http://fr.pornhub.com/view_video.php?viewkey=ph55ca2f9760862',
130 'only_matching': True,
eaaaaec0
S
131 }, {
132 # removed at the request of the copyright owner
133 'url': 'http://www.pornhub.com/view_video.php?viewkey=788152859',
134 'only_matching': True,
135 }, {
136 # removed by uploader
137 'url': 'http://www.pornhub.com/view_video.php?viewkey=ph572716d15a111',
138 'only_matching': True,
195f0845
S
139 }, {
140 # private video
141 'url': 'http://www.pornhub.com/view_video.php?viewkey=ph56fd731fce6b7',
142 'only_matching': True,
bc4b2d75
S
143 }, {
144 'url': 'https://www.thumbzilla.com/video/ph56c6114abd99a/horny-girlfriend-sex',
145 'only_matching': True,
a99cc4ca
S
146 }, {
147 'url': 'http://www.pornhub.com/video/show?viewkey=648719015',
148 'only_matching': True,
f97c0991
S
149 }, {
150 'url': 'https://www.pornhub.net/view_video.php?viewkey=203640933',
151 'only_matching': True,
fa9b8c66
TW
152 }, {
153 'url': 'https://www.pornhubpremium.com/view_video.php?viewkey=ph5e4acdae54a82',
154 'only_matching': True,
360075e2 155 }]
125cfd78 156
b52c9ef1
S
157 @staticmethod
158 def _extract_urls(webpage):
159 return re.findall(
3430ff9b 160 r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub\.(?:com|net)/embed/[\da-z]+)',
b52c9ef1 161 webpage)
65d161c4 162
0320ddc1 163 def _extract_count(self, pattern, webpage, name):
7700207e
S
164 return str_to_int(self._search_regex(
165 pattern, webpage, '%s count' % name, fatal=False))
0320ddc1 166
125cfd78 167 def _real_extract(self, url):
3430ff9b
S
168 mobj = re.match(self._VALID_URL, url)
169 host = mobj.group('host') or 'pornhub.com'
170 video_id = mobj.group('id')
7399ca1f 171
fa9b8c66
TW
172 if 'premium' in host:
173 if not self._downloader.params.get('cookiefile'):
174 raise ExtractorError(
175 'PornHub Premium requires authentication.'
176 ' You may want to use --cookies.',
177 expected=True)
178
3430ff9b 179 self._set_cookie(host, 'age_verified', '1')
125cfd78 180
9a372f14 181 def dl_webpage(platform):
3430ff9b 182 self._set_cookie(host, 'platform', platform)
9a372f14 183 return self._download_webpage(
2c53c0eb 184 'https://www.%s/view_video.php?viewkey=%s' % (host, video_id),
79367a98 185 video_id, 'Downloading %s webpage' % platform)
9a372f14
S
186
187 webpage = dl_webpage('pc')
125cfd78 188
50789175 189 error_msg = self._html_search_regex(
add7d2a0 190 r'(?s)<div[^>]+class=(["\'])(?:(?!\1).)*\b(?:removed|userMessageSection)\b(?:(?!\1).)*\1[^>]*>(?P<error>.+?)</div>',
3cb3b600 191 webpage, 'error message', default=None, group='error')
50789175
PH
192 if error_msg:
193 error_msg = re.sub(r'\s+', ' ', error_msg)
194 raise ExtractorError(
195 'PornHub said: %s' % error_msg,
196 expected=True, video_id=video_id)
197
6c376029
S
198 # video_title from flashvars contains whitespace instead of non-ASCII (see
199 # http://www.pornhub.com/view_video.php?viewkey=1331683002), not relying
200 # on that anymore.
79367a98 201 title = self._html_search_meta(
46cc54ca
S
202 'twitter:title', webpage, default=None) or self._html_search_regex(
203 (r'(?s)<h1[^>]+class=["\']title["\'][^>]*>(?P<title>.+?)</h1>',
204 r'<div[^>]+data-video-title=(["\'])(?P<title>(?:(?!\1).)+)\1',
205 r'shareTitle["\']\s*[=:]\s*(["\'])(?P<title>(?:(?!\1).)+)\1'),
6c376029
S
206 webpage, 'title', group='title')
207
79367a98
S
208 video_urls = []
209 video_urls_set = set()
4938c8d5 210 subtitles = {}
79367a98 211
ed8648a3
S
212 flashvars = self._parse_json(
213 self._search_regex(
03442072 214 r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'),
ed8648a3
S
215 video_id)
216 if flashvars:
4938c8d5
GF
217 subtitle_url = url_or_none(flashvars.get('closedCaptionsFile'))
218 if subtitle_url:
219 subtitles.setdefault('en', []).append({
220 'url': subtitle_url,
221 'ext': 'srt',
222 })
ed8648a3
S
223 thumbnail = flashvars.get('image_url')
224 duration = int_or_none(flashvars.get('video_duration'))
79367a98
S
225 media_definitions = flashvars.get('mediaDefinitions')
226 if isinstance(media_definitions, list):
227 for definition in media_definitions:
228 if not isinstance(definition, dict):
229 continue
230 video_url = definition.get('videoUrl')
231 if not video_url or not isinstance(video_url, compat_str):
232 continue
233 if video_url in video_urls_set:
234 continue
235 video_urls_set.add(video_url)
236 video_urls.append(
237 (video_url, int_or_none(definition.get('quality'))))
ed8648a3 238 else:
79367a98
S
239 thumbnail, duration = [None] * 2
240
0164cd5d 241 def extract_js_vars(webpage, pattern, default=NO_DEFAULT):
79367a98 242 assignments = self._search_regex(
0164cd5d 243 pattern, webpage, 'encoded url', default=default)
f4134726
S
244 if not assignments:
245 return {}
246
247 assignments = assignments.split(';')
79367a98
S
248
249 js_vars = {}
250
251 def parse_js_value(inp):
252 inp = re.sub(r'/\*(?:(?!\*/).)*?\*/', '', inp)
253 if '+' in inp:
254 inps = inp.split('+')
255 return functools.reduce(
256 operator.concat, map(parse_js_value, inps))
257 inp = inp.strip()
258 if inp in js_vars:
259 return js_vars[inp]
260 return remove_quotes(inp)
261
262 for assn in assignments:
263 assn = assn.strip()
264 if not assn:
265 continue
266 assn = re.sub(r'var\s+', '', assn)
267 vname, value = assn.split('=', 1)
268 js_vars[vname] = parse_js_value(value)
f4134726 269 return js_vars
79367a98 270
f4134726
S
271 def add_video_url(video_url):
272 v_url = url_or_none(video_url)
273 if not v_url:
274 return
275 if v_url in video_urls_set:
276 return
277 video_urls.append((v_url, None))
278 video_urls_set.add(v_url)
279
280 if not video_urls:
281 FORMAT_PREFIXES = ('media', 'quality')
282 js_vars = extract_js_vars(
283 webpage, r'(var\s+(?:%s)_.+)' % '|'.join(FORMAT_PREFIXES),
0164cd5d 284 default=None)
f4134726
S
285 if js_vars:
286 for key, format_url in js_vars.items():
287 if any(key.startswith(p) for p in FORMAT_PREFIXES):
288 add_video_url(format_url)
0164cd5d
S
289 if not video_urls and re.search(
290 r'<[^>]+\bid=["\']lockedPlayer', webpage):
291 raise ExtractorError(
292 'Video %s is locked' % video_id, expected=True)
f4134726
S
293
294 if not video_urls:
295 js_vars = extract_js_vars(
296 dl_webpage('tv'), r'(var.+?mediastring.+?)</script>')
297 add_video_url(js_vars['mediastring'])
79367a98
S
298
299 for mobj in re.finditer(
300 r'<a[^>]+\bclass=["\']downloadBtn\b[^>]+\bhref=(["\'])(?P<url>(?:(?!\1).)+)\1',
301 webpage):
302 video_url = mobj.group('url')
303 if video_url not in video_urls_set:
304 video_urls.append((video_url, None))
305 video_urls_set.add(video_url)
306
3661ebf2 307 upload_date = None
79367a98
S
308 formats = []
309 for video_url, height in video_urls:
3661ebf2
S
310 if not upload_date:
311 upload_date = self._search_regex(
312 r'/(\d{6}/\d{2})/', video_url, 'upload data', default=None)
313 if upload_date:
314 upload_date = upload_date.replace('/', '')
f4134726
S
315 ext = determine_ext(video_url)
316 if ext == 'mpd':
b8526c78
S
317 formats.extend(self._extract_mpd_formats(
318 video_url, video_id, mpd_id='dash', fatal=False))
319 continue
f4134726
S
320 elif ext == 'm3u8':
321 formats.extend(self._extract_m3u8_formats(
322 video_url, video_id, 'mp4', entry_protocol='m3u8_native',
323 m3u8_id='hls', fatal=False))
324 continue
79367a98
S
325 tbr = None
326 mobj = re.search(r'(?P<height>\d+)[pP]?_(?P<tbr>\d+)[kK]', video_url)
327 if mobj:
328 if not height:
329 height = int(mobj.group('height'))
330 tbr = int(mobj.group('tbr'))
331 formats.append({
332 'url': video_url,
333 'format_id': '%dp' % height if height else None,
334 'height': height,
335 'tbr': tbr,
336 })
337 self._sort_formats(formats)
ed8648a3 338
0320ddc1 339 video_uploader = self._html_search_regex(
2d4fe594 340 r'(?s)From:&nbsp;.+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<',
0320ddc1 341 webpage, 'uploader', fatal=False)
125cfd78 342
7700207e
S
343 view_count = self._extract_count(
344 r'<span class="count">([\d,\.]+)</span> views', webpage, 'view')
345 like_count = self._extract_count(
346 r'<span class="votesUp">([\d,\.]+)</span>', webpage, 'like')
347 dislike_count = self._extract_count(
348 r'<span class="votesDown">([\d,\.]+)</span>', webpage, 'dislike')
0320ddc1 349 comment_count = self._extract_count(
7700207e 350 r'All Comments\s*<span>\(([\d,.]+)\)', webpage, 'comment')
0320ddc1 351
5dda1ede 352 def extract_list(meta_key):
d2d970d0 353 div = self._search_regex(
5dda1ede
S
354 r'(?s)<div[^>]+\bclass=["\'].*?\b%sWrapper[^>]*>(.+?)</div>'
355 % meta_key, webpage, meta_key, default=None)
d2d970d0 356 if div:
5dda1ede 357 return re.findall(r'<a[^>]+\bhref=[^>]+>([^<]+)', div)
6bb05b32 358
125cfd78 359 return {
360 'id': video_id,
361 'uploader': video_uploader,
3661ebf2 362 'upload_date': upload_date,
6c376029 363 'title': title,
125cfd78 364 'thumbnail': thumbnail,
ed8648a3 365 'duration': duration,
0320ddc1
S
366 'view_count': view_count,
367 'like_count': like_count,
368 'dislike_count': dislike_count,
369 'comment_count': comment_count,
79367a98 370 'formats': formats,
750e9833 371 'age_limit': 18,
5dda1ede
S
372 'tags': extract_list('tags'),
373 'categories': extract_list('categories'),
4938c8d5 374 'subtitles': subtitles,
125cfd78 375 }
e66e1a00
S
376
377
71a1f617 378class PornHubPlaylistBaseIE(PornHubBaseIE):
3430ff9b 379 def _extract_entries(self, webpage, host):
475bcb22
S
380 # Only process container div with main playlist content skipping
381 # drop-down menu that uses similar pattern for videos (see
067aa17e 382 # https://github.com/ytdl-org/youtube-dl/issues/11594).
475bcb22
S
383 container = self._search_regex(
384 r'(?s)(<div[^>]+class=["\']container.+)', webpage,
385 'container', default=webpage)
386
40e146aa 387 return [
3a23bae9 388 self.url_result(
3430ff9b 389 'http://www.%s/%s' % (host, video_url),
3a23bae9
S
390 PornHubIE.ie_key(), video_title=title)
391 for video_url, title in orderedSet(re.findall(
392 r'href="/?(view_video\.php\?.*\bviewkey=[\da-z]+[^"]*)"[^>]*\s+title="([^"]+)"',
475bcb22 393 container))
40e146aa 394 ]
e66e1a00
S
395
396 def _real_extract(self, url):
3430ff9b
S
397 mobj = re.match(self._VALID_URL, url)
398 host = mobj.group('host')
399 playlist_id = mobj.group('id')
e66e1a00
S
400
401 webpage = self._download_webpage(url, playlist_id)
402
3430ff9b 403 entries = self._extract_entries(webpage, host)
e66e1a00
S
404
405 playlist = self._parse_json(
406 self._search_regex(
cd138d8b
S
407 r'(?:playlistObject|PLAYLIST_VIEW)\s*=\s*({.+?});', webpage,
408 'playlist', default='{}'),
409 playlist_id, fatal=False)
410 title = playlist.get('title') or self._search_regex(
411 r'>Videos\s+in\s+(.+?)\s+[Pp]laylist<', webpage, 'title', fatal=False)
e66e1a00
S
412
413 return self.playlist_result(
cd138d8b 414 entries, playlist_id, title, playlist.get('description'))
40e146aa
S
415
416
21b08463 417class PornHubUserIE(PornHubPlaylistBaseIE):
fa9b8c66 418 _VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net))/(?:(?:user|channel)s|model|pornstar)/(?P<id>[^/?#&]+))(?:[?#&]|/(?!videos)|$)'
40e146aa 419 _TESTS = [{
21b08463
S
420 'url': 'https://www.pornhub.com/model/zoe_ph',
421 'playlist_mincount': 118,
422 }, {
423 'url': 'https://www.pornhub.com/pornstar/liz-vicious',
40e146aa 424 'info_dict': {
21b08463 425 'id': 'liz-vicious',
40e146aa 426 },
21b08463
S
427 'playlist_mincount': 118,
428 }, {
429 'url': 'https://www.pornhub.com/users/russianveet69',
9634de17 430 'only_matching': True,
21b08463
S
431 }, {
432 'url': 'https://www.pornhub.com/channels/povd',
9634de17
S
433 'only_matching': True,
434 }, {
435 'url': 'https://www.pornhub.com/model/zoe_ph?abc=1',
436 'only_matching': True,
21b08463
S
437 }]
438
21b08463
S
439 def _real_extract(self, url):
440 mobj = re.match(self._VALID_URL, url)
441 user_id = mobj.group('id')
442 return self.url_result(
9634de17 443 '%s/videos' % mobj.group('url'), ie=PornHubPagedVideoListIE.ie_key(),
21b08463
S
444 video_id=user_id)
445
446
447class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE):
4bf568d3
S
448 @staticmethod
449 def _has_more(webpage):
450 return re.search(
451 r'''(?x)
452 <li[^>]+\bclass=["\']page_next|
453 <link[^>]+\brel=["\']next|
454 <button[^>]+\bid=["\']moreDataBtn
455 ''', webpage) is not None
456
21b08463
S
457 def _real_extract(self, url):
458 mobj = re.match(self._VALID_URL, url)
459 host = mobj.group('host')
9634de17 460 item_id = mobj.group('id')
21b08463 461
1f7a563a
S
462 page = int_or_none(self._search_regex(
463 r'\bpage=(\d+)', url, 'page', default=None))
464
21b08463 465 entries = []
1f7a563a 466 for page_num in (page, ) if page is not None else itertools.count(1):
21b08463
S
467 try:
468 webpage = self._download_webpage(
4bf568d3 469 url, item_id, 'Downloading page %d' % page_num,
21b08463
S
470 query={'page': page_num})
471 except ExtractorError as e:
472 if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
473 break
474 raise
475 page_entries = self._extract_entries(webpage, host)
476 if not page_entries:
477 break
478 entries.extend(page_entries)
479 if not self._has_more(webpage):
480 break
481
9634de17 482 return self.playlist_result(orderedSet(entries), item_id)
21b08463
S
483
484
9634de17 485class PornHubPagedVideoListIE(PornHubPagedPlaylistBaseIE):
fa9b8c66 486 _VALID_URL = r'https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net))/(?P<id>(?:[^/]+/)*[^/?#&]+)'
21b08463 487 _TESTS = [{
1f7a563a 488 'url': 'https://www.pornhub.com/model/zoe_ph/videos',
21b08463 489 'only_matching': True,
34541395
S
490 }, {
491 'url': 'http://www.pornhub.com/users/rushandlia/videos',
492 'only_matching': True,
21b08463
S
493 }, {
494 'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos',
495 'info_dict': {
9634de17 496 'id': 'pornstar/jenny-blighe/videos',
21b08463
S
497 },
498 'playlist_mincount': 149,
1f7a563a
S
499 }, {
500 'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos?page=3',
501 'info_dict': {
9634de17 502 'id': 'pornstar/jenny-blighe/videos',
1f7a563a
S
503 },
504 'playlist_mincount': 40,
f66df20c
PV
505 }, {
506 # default sorting as Top Rated Videos
507 'url': 'https://www.pornhub.com/channels/povd/videos',
508 'info_dict': {
9634de17 509 'id': 'channels/povd/videos',
f66df20c
PV
510 },
511 'playlist_mincount': 293,
512 }, {
513 # Top Rated Videos
514 'url': 'https://www.pornhub.com/channels/povd/videos?o=ra',
515 'only_matching': True,
516 }, {
517 # Most Recent Videos
518 'url': 'https://www.pornhub.com/channels/povd/videos?o=da',
519 'only_matching': True,
520 }, {
521 # Most Viewed Videos
522 'url': 'https://www.pornhub.com/channels/povd/videos?o=vi',
523 'only_matching': True,
92ded33a
S
524 }, {
525 'url': 'http://www.pornhub.com/users/zoe_ph/videos/public',
526 'only_matching': True,
21b08463
S
527 }, {
528 # Most Viewed Videos
529 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=mv',
530 'only_matching': True,
531 }, {
532 # Top Rated Videos
533 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=tr',
534 'only_matching': True,
535 }, {
536 # Longest Videos
537 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=lg',
538 'only_matching': True,
539 }, {
540 # Newest Videos
541 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=cm',
542 'only_matching': True,
21b08463
S
543 }, {
544 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos/paid',
545 'only_matching': True,
546 }, {
547 'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos/fanonly',
548 'only_matching': True,
9634de17
S
549 }, {
550 'url': 'https://www.pornhub.com/video',
551 'only_matching': True,
552 }, {
553 'url': 'https://www.pornhub.com/video?page=3',
554 'only_matching': True,
555 }, {
556 'url': 'https://www.pornhub.com/video/search?search=123',
557 'only_matching': True,
558 }, {
559 'url': 'https://www.pornhub.com/categories/teen',
560 'only_matching': True,
561 }, {
562 'url': 'https://www.pornhub.com/categories/teen?page=3',
563 'only_matching': True,
564 }, {
565 'url': 'https://www.pornhub.com/hd',
566 'only_matching': True,
567 }, {
568 'url': 'https://www.pornhub.com/hd?page=3',
569 'only_matching': True,
570 }, {
571 'url': 'https://www.pornhub.com/described-video',
572 'only_matching': True,
573 }, {
574 'url': 'https://www.pornhub.com/described-video?page=2',
575 'only_matching': True,
576 }, {
577 'url': 'https://www.pornhub.com/video/incategories/60fps-1/hd-porn',
578 'only_matching': True,
579 }, {
580 'url': 'https://www.pornhub.com/playlist/44121572',
581 'info_dict': {
582 'id': 'playlist/44121572',
583 },
584 'playlist_mincount': 132,
585 }, {
586 'url': 'https://www.pornhub.com/playlist/4667351',
587 'only_matching': True,
588 }, {
589 'url': 'https://de.pornhub.com/playlist/4667351',
590 'only_matching': True,
40e146aa
S
591 }]
592
21b08463
S
593 @classmethod
594 def suitable(cls, url):
595 return (False
9634de17
S
596 if PornHubIE.suitable(url) or PornHubUserIE.suitable(url) or PornHubUserVideosUploadIE.suitable(url)
597 else super(PornHubPagedVideoListIE, cls).suitable(url))
21b08463 598
34541395 599
21b08463 600class PornHubUserVideosUploadIE(PornHubPagedPlaylistBaseIE):
fa9b8c66 601 _VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net))/(?:(?:user|channel)s|model|pornstar)/(?P<id>[^/]+)/videos/upload)'
21b08463
S
602 _TESTS = [{
603 'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos/upload',
604 'info_dict': {
605 'id': 'jenny-blighe',
606 },
607 'playlist_mincount': 129,
608 }, {
609 'url': 'https://www.pornhub.com/model/zoe_ph/videos/upload',
610 'only_matching': True,
611 }]