]> asedeno.scripts.mit.edu Git - youtube-dl.git/blob - youtube_dl/extractor/pornhub.py
[eroprofile] Skip test
[youtube-dl.git] / youtube_dl / extractor / pornhub.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import functools
5 import itertools
6 import operator
7 import re
8
9 from .common import InfoExtractor
10 from ..compat import (
11     compat_HTTPError,
12     compat_str,
13     compat_urllib_request,
14 )
15 from .openload import PhantomJSwrapper
16 from ..utils import (
17     determine_ext,
18     ExtractorError,
19     int_or_none,
20     merge_dicts,
21     NO_DEFAULT,
22     orderedSet,
23     remove_quotes,
24     str_to_int,
25     update_url_query,
26     urlencode_postdata,
27     url_or_none,
28 )
29
30
31 class PornHubBaseIE(InfoExtractor):
32     _NETRC_MACHINE = 'pornhub'
33
34     def _download_webpage_handle(self, *args, **kwargs):
35         def dl(*args, **kwargs):
36             return super(PornHubBaseIE, self)._download_webpage_handle(*args, **kwargs)
37
38         ret = dl(*args, **kwargs)
39
40         if not ret:
41             return ret
42
43         webpage, urlh = ret
44
45         if any(re.search(p, webpage) for p in (
46                 r'<body\b[^>]+\bonload=["\']go\(\)',
47                 r'document\.cookie\s*=\s*["\']RNKEY=',
48                 r'document\.location\.reload\(true\)')):
49             url_or_request = args[0]
50             url = (url_or_request.get_full_url()
51                    if isinstance(url_or_request, compat_urllib_request.Request)
52                    else url_or_request)
53             phantom = PhantomJSwrapper(self, required_version='2.0')
54             phantom.get(url, html=webpage)
55             webpage, urlh = dl(*args, **kwargs)
56
57         return webpage, urlh
58
59     def _real_initialize(self):
60         self._logged_in = False
61
62     def _login(self, host):
63         if self._logged_in:
64             return
65
66         site = host.split('.')[0]
67
68         # Both sites pornhub and pornhubpremium have separate accounts
69         # so there should be an option to provide credentials for both.
70         # At the same time some videos are available under the same video id
71         # on both sites so that we have to identify them as the same video.
72         # For that purpose we have to keep both in the same extractor
73         # but under different netrc machines.
74         username, password = self._get_login_info(netrc_machine=site)
75         if username is None:
76             return
77
78         login_url = 'https://www.%s/%slogin' % (host, 'premium/' if 'premium' in host else '')
79         login_page = self._download_webpage(
80             login_url, None, 'Downloading %s login page' % site)
81
82         def is_logged(webpage):
83             return any(re.search(p, webpage) for p in (
84                 r'class=["\']signOut',
85                 r'>Sign\s+[Oo]ut\s*<'))
86
87         if is_logged(login_page):
88             self._logged_in = True
89             return
90
91         login_form = self._hidden_inputs(login_page)
92
93         login_form.update({
94             'username': username,
95             'password': password,
96         })
97
98         response = self._download_json(
99             'https://www.%s/front/authenticate' % host, None,
100             'Logging in to %s' % site,
101             data=urlencode_postdata(login_form),
102             headers={
103                 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
104                 'Referer': login_url,
105                 'X-Requested-With': 'XMLHttpRequest',
106             })
107
108         if response.get('success') == '1':
109             self._logged_in = True
110             return
111
112         message = response.get('message')
113         if message is not None:
114             raise ExtractorError(
115                 'Unable to login: %s' % message, expected=True)
116
117         raise ExtractorError('Unable to log in')
118
119
120 class PornHubIE(PornHubBaseIE):
121     IE_DESC = 'PornHub and Thumbzilla'
122     _VALID_URL = r'''(?x)
123                     https?://
124                         (?:
125                             (?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net|org))/(?:(?:view_video\.php|video/show)\?viewkey=|embed/)|
126                             (?:www\.)?thumbzilla\.com/video/
127                         )
128                         (?P<id>[\da-z]+)
129                     '''
130     _TESTS = [{
131         'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
132         'md5': 'a6391306d050e4547f62b3f485dd9ba9',
133         'info_dict': {
134             'id': '648719015',
135             'ext': 'mp4',
136             'title': 'Seductive Indian beauty strips down and fingers her pink pussy',
137             'uploader': 'Babes',
138             'upload_date': '20130628',
139             'timestamp': 1372447216,
140             'duration': 361,
141             'view_count': int,
142             'like_count': int,
143             'dislike_count': int,
144             'comment_count': int,
145             'age_limit': 18,
146             'tags': list,
147             'categories': list,
148         },
149     }, {
150         # non-ASCII title
151         'url': 'http://www.pornhub.com/view_video.php?viewkey=1331683002',
152         'info_dict': {
153             'id': '1331683002',
154             'ext': 'mp4',
155             'title': '重庆婷婷女王足交',
156             'upload_date': '20150213',
157             'timestamp': 1423804862,
158             'duration': 1753,
159             'view_count': int,
160             'like_count': int,
161             'dislike_count': int,
162             'comment_count': int,
163             'age_limit': 18,
164             'tags': list,
165             'categories': list,
166         },
167         'params': {
168             'skip_download': True,
169         },
170         'skip': 'Video has been flagged for verification in accordance with our trust and safety policy',
171     }, {
172         # subtitles
173         'url': 'https://www.pornhub.com/view_video.php?viewkey=ph5af5fef7c2aa7',
174         'info_dict': {
175             'id': 'ph5af5fef7c2aa7',
176             'ext': 'mp4',
177             'title': 'BFFS - Cute Teen Girls Share Cock On the Floor',
178             'uploader': 'BFFs',
179             'duration': 622,
180             'view_count': int,
181             'like_count': int,
182             'dislike_count': int,
183             'comment_count': int,
184             'age_limit': 18,
185             'tags': list,
186             'categories': list,
187             'subtitles': {
188                 'en': [{
189                     "ext": 'srt'
190                 }]
191             },
192         },
193         'params': {
194             'skip_download': True,
195         },
196         'skip': 'This video has been disabled',
197     }, {
198         'url': 'http://www.pornhub.com/view_video.php?viewkey=ph557bbb6676d2d',
199         'only_matching': True,
200     }, {
201         # removed at the request of cam4.com
202         'url': 'http://fr.pornhub.com/view_video.php?viewkey=ph55ca2f9760862',
203         'only_matching': True,
204     }, {
205         # removed at the request of the copyright owner
206         'url': 'http://www.pornhub.com/view_video.php?viewkey=788152859',
207         'only_matching': True,
208     }, {
209         # removed by uploader
210         'url': 'http://www.pornhub.com/view_video.php?viewkey=ph572716d15a111',
211         'only_matching': True,
212     }, {
213         # private video
214         'url': 'http://www.pornhub.com/view_video.php?viewkey=ph56fd731fce6b7',
215         'only_matching': True,
216     }, {
217         'url': 'https://www.thumbzilla.com/video/ph56c6114abd99a/horny-girlfriend-sex',
218         'only_matching': True,
219     }, {
220         'url': 'http://www.pornhub.com/video/show?viewkey=648719015',
221         'only_matching': True,
222     }, {
223         'url': 'https://www.pornhub.net/view_video.php?viewkey=203640933',
224         'only_matching': True,
225     }, {
226         'url': 'https://www.pornhub.org/view_video.php?viewkey=203640933',
227         'only_matching': True,
228     }, {
229         'url': 'https://www.pornhubpremium.com/view_video.php?viewkey=ph5e4acdae54a82',
230         'only_matching': True,
231     }, {
232         # Some videos are available with the same id on both premium
233         # and non-premium sites (e.g. this and the following test)
234         'url': 'https://www.pornhub.com/view_video.php?viewkey=ph5f75b0f4b18e3',
235         'only_matching': True,
236     }, {
237         'url': 'https://www.pornhubpremium.com/view_video.php?viewkey=ph5f75b0f4b18e3',
238         'only_matching': True,
239     }]
240
241     @staticmethod
242     def _extract_urls(webpage):
243         return re.findall(
244             r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub(?:premium)?\.(?:com|net|org)/embed/[\da-z]+)',
245             webpage)
246
247     def _extract_count(self, pattern, webpage, name):
248         return str_to_int(self._search_regex(
249             pattern, webpage, '%s count' % name, fatal=False))
250
251     def _real_extract(self, url):
252         mobj = re.match(self._VALID_URL, url)
253         host = mobj.group('host') or 'pornhub.com'
254         video_id = mobj.group('id')
255
256         self._login(host)
257
258         self._set_cookie(host, 'age_verified', '1')
259
260         def dl_webpage(platform):
261             self._set_cookie(host, 'platform', platform)
262             return self._download_webpage(
263                 'https://www.%s/view_video.php?viewkey=%s' % (host, video_id),
264                 video_id, 'Downloading %s webpage' % platform)
265
266         webpage = dl_webpage('pc')
267
268         error_msg = self._html_search_regex(
269             (r'(?s)<div[^>]+class=(["\'])(?:(?!\1).)*\b(?:removed|userMessageSection)\b(?:(?!\1).)*\1[^>]*>(?P<error>.+?)</div>',
270              r'(?s)<section[^>]+class=["\']noVideo["\'][^>]*>(?P<error>.+?)</section>'),
271             webpage, 'error message', default=None, group='error')
272         if error_msg:
273             error_msg = re.sub(r'\s+', ' ', error_msg)
274             raise ExtractorError(
275                 'PornHub said: %s' % error_msg,
276                 expected=True, video_id=video_id)
277
278         # video_title from flashvars contains whitespace instead of non-ASCII (see
279         # http://www.pornhub.com/view_video.php?viewkey=1331683002), not relying
280         # on that anymore.
281         title = self._html_search_meta(
282             'twitter:title', webpage, default=None) or self._html_search_regex(
283             (r'(?s)<h1[^>]+class=["\']title["\'][^>]*>(?P<title>.+?)</h1>',
284              r'<div[^>]+data-video-title=(["\'])(?P<title>(?:(?!\1).)+)\1',
285              r'shareTitle["\']\s*[=:]\s*(["\'])(?P<title>(?:(?!\1).)+)\1'),
286             webpage, 'title', group='title')
287
288         video_urls = []
289         video_urls_set = set()
290         subtitles = {}
291
292         flashvars = self._parse_json(
293             self._search_regex(
294                 r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'),
295             video_id)
296         if flashvars:
297             subtitle_url = url_or_none(flashvars.get('closedCaptionsFile'))
298             if subtitle_url:
299                 subtitles.setdefault('en', []).append({
300                     'url': subtitle_url,
301                     'ext': 'srt',
302                 })
303             thumbnail = flashvars.get('image_url')
304             duration = int_or_none(flashvars.get('video_duration'))
305             media_definitions = flashvars.get('mediaDefinitions')
306             if isinstance(media_definitions, list):
307                 for definition in media_definitions:
308                     if not isinstance(definition, dict):
309                         continue
310                     video_url = definition.get('videoUrl')
311                     if not video_url or not isinstance(video_url, compat_str):
312                         continue
313                     if video_url in video_urls_set:
314                         continue
315                     video_urls_set.add(video_url)
316                     video_urls.append(
317                         (video_url, int_or_none(definition.get('quality'))))
318         else:
319             thumbnail, duration = [None] * 2
320
321         def extract_js_vars(webpage, pattern, default=NO_DEFAULT):
322             assignments = self._search_regex(
323                 pattern, webpage, 'encoded url', default=default)
324             if not assignments:
325                 return {}
326
327             assignments = assignments.split(';')
328
329             js_vars = {}
330
331             def parse_js_value(inp):
332                 inp = re.sub(r'/\*(?:(?!\*/).)*?\*/', '', inp)
333                 if '+' in inp:
334                     inps = inp.split('+')
335                     return functools.reduce(
336                         operator.concat, map(parse_js_value, inps))
337                 inp = inp.strip()
338                 if inp in js_vars:
339                     return js_vars[inp]
340                 return remove_quotes(inp)
341
342             for assn in assignments:
343                 assn = assn.strip()
344                 if not assn:
345                     continue
346                 assn = re.sub(r'var\s+', '', assn)
347                 vname, value = assn.split('=', 1)
348                 js_vars[vname] = parse_js_value(value)
349             return js_vars
350
351         def add_video_url(video_url):
352             v_url = url_or_none(video_url)
353             if not v_url:
354                 return
355             if v_url in video_urls_set:
356                 return
357             video_urls.append((v_url, None))
358             video_urls_set.add(v_url)
359
360         def parse_quality_items(quality_items):
361             q_items = self._parse_json(quality_items, video_id, fatal=False)
362             if not isinstance(q_items, list):
363                 return
364             for item in q_items:
365                 if isinstance(item, dict):
366                     add_video_url(item.get('url'))
367
368         if not video_urls:
369             FORMAT_PREFIXES = ('media', 'quality', 'qualityItems')
370             js_vars = extract_js_vars(
371                 webpage, r'(var\s+(?:%s)_.+)' % '|'.join(FORMAT_PREFIXES),
372                 default=None)
373             if js_vars:
374                 for key, format_url in js_vars.items():
375                     if key.startswith(FORMAT_PREFIXES[-1]):
376                         parse_quality_items(format_url)
377                     elif any(key.startswith(p) for p in FORMAT_PREFIXES[:2]):
378                         add_video_url(format_url)
379             if not video_urls and re.search(
380                     r'<[^>]+\bid=["\']lockedPlayer', webpage):
381                 raise ExtractorError(
382                     'Video %s is locked' % video_id, expected=True)
383
384         if not video_urls:
385             js_vars = extract_js_vars(
386                 dl_webpage('tv'), r'(var.+?mediastring.+?)</script>')
387             add_video_url(js_vars['mediastring'])
388
389         for mobj in re.finditer(
390                 r'<a[^>]+\bclass=["\']downloadBtn\b[^>]+\bhref=(["\'])(?P<url>(?:(?!\1).)+)\1',
391                 webpage):
392             video_url = mobj.group('url')
393             if video_url not in video_urls_set:
394                 video_urls.append((video_url, None))
395                 video_urls_set.add(video_url)
396
397         upload_date = None
398         formats = []
399
400         def add_format(format_url, height=None):
401             ext = determine_ext(format_url)
402             if ext == 'mpd':
403                 formats.extend(self._extract_mpd_formats(
404                     format_url, video_id, mpd_id='dash', fatal=False))
405                 return
406             if ext == 'm3u8':
407                 formats.extend(self._extract_m3u8_formats(
408                     format_url, video_id, 'mp4', entry_protocol='m3u8_native',
409                     m3u8_id='hls', fatal=False))
410                 return
411             tbr = None
412             mobj = re.search(r'(?P<height>\d+)[pP]?_(?P<tbr>\d+)[kK]', format_url)
413             if mobj:
414                 if not height:
415                     height = int(mobj.group('height'))
416                 tbr = int(mobj.group('tbr'))
417             formats.append({
418                 'url': format_url,
419                 'format_id': '%dp' % height if height else None,
420                 'height': height,
421                 'tbr': tbr,
422             })
423
424         for video_url, height in video_urls:
425             if not upload_date:
426                 upload_date = self._search_regex(
427                     r'/(\d{6}/\d{2})/', video_url, 'upload data', default=None)
428                 if upload_date:
429                     upload_date = upload_date.replace('/', '')
430             if '/video/get_media' in video_url:
431                 medias = self._download_json(video_url, video_id, fatal=False)
432                 if isinstance(medias, list):
433                     for media in medias:
434                         if not isinstance(media, dict):
435                             continue
436                         video_url = url_or_none(media.get('videoUrl'))
437                         if not video_url:
438                             continue
439                         height = int_or_none(media.get('quality'))
440                         add_format(video_url, height)
441                 continue
442             add_format(video_url)
443         self._sort_formats(formats)
444
445         video_uploader = self._html_search_regex(
446             r'(?s)From:&nbsp;.+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<',
447             webpage, 'uploader', default=None)
448
449         def extract_vote_count(kind, name):
450             return self._extract_count(
451                 (r'<span[^>]+\bclass="votes%s"[^>]*>([\d,\.]+)</span>' % kind,
452                  r'<span[^>]+\bclass=["\']votes%s["\'][^>]*\bdata-rating=["\'](\d+)' % kind),
453                 webpage, name)
454
455         view_count = self._extract_count(
456             r'<span class="count">([\d,\.]+)</span> [Vv]iews', webpage, 'view')
457         like_count = extract_vote_count('Up', 'like')
458         dislike_count = extract_vote_count('Down', 'dislike')
459         comment_count = self._extract_count(
460             r'All Comments\s*<span>\(([\d,.]+)\)', webpage, 'comment')
461
462         def extract_list(meta_key):
463             div = self._search_regex(
464                 r'(?s)<div[^>]+\bclass=["\'].*?\b%sWrapper[^>]*>(.+?)</div>'
465                 % meta_key, webpage, meta_key, default=None)
466             if div:
467                 return re.findall(r'<a[^>]+\bhref=[^>]+>([^<]+)', div)
468
469         info = self._search_json_ld(webpage, video_id, default={})
470         # description provided in JSON-LD is irrelevant
471         info['description'] = None
472
473         return merge_dicts({
474             'id': video_id,
475             'uploader': video_uploader,
476             'upload_date': upload_date,
477             'title': title,
478             'thumbnail': thumbnail,
479             'duration': duration,
480             'view_count': view_count,
481             'like_count': like_count,
482             'dislike_count': dislike_count,
483             'comment_count': comment_count,
484             'formats': formats,
485             'age_limit': 18,
486             'tags': extract_list('tags'),
487             'categories': extract_list('categories'),
488             'subtitles': subtitles,
489         }, info)
490
491
492 class PornHubPlaylistBaseIE(PornHubBaseIE):
493     def _extract_page(self, url):
494         return int_or_none(self._search_regex(
495             r'\bpage=(\d+)', url, 'page', default=None))
496
497     def _extract_entries(self, webpage, host):
498         # Only process container div with main playlist content skipping
499         # drop-down menu that uses similar pattern for videos (see
500         # https://github.com/ytdl-org/youtube-dl/issues/11594).
501         container = self._search_regex(
502             r'(?s)(<div[^>]+class=["\']container.+)', webpage,
503             'container', default=webpage)
504
505         return [
506             self.url_result(
507                 'http://www.%s/%s' % (host, video_url),
508                 PornHubIE.ie_key(), video_title=title)
509             for video_url, title in orderedSet(re.findall(
510                 r'href="/?(view_video\.php\?.*\bviewkey=[\da-z]+[^"]*)"[^>]*\s+title="([^"]+)"',
511                 container))
512         ]
513
514
515 class PornHubUserIE(PornHubPlaylistBaseIE):
516     _VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net|org))/(?:(?:user|channel)s|model|pornstar)/(?P<id>[^/?#&]+))(?:[?#&]|/(?!videos)|$)'
517     _TESTS = [{
518         'url': 'https://www.pornhub.com/model/zoe_ph',
519         'playlist_mincount': 118,
520     }, {
521         'url': 'https://www.pornhub.com/pornstar/liz-vicious',
522         'info_dict': {
523             'id': 'liz-vicious',
524         },
525         'playlist_mincount': 118,
526     }, {
527         'url': 'https://www.pornhub.com/users/russianveet69',
528         'only_matching': True,
529     }, {
530         'url': 'https://www.pornhub.com/channels/povd',
531         'only_matching': True,
532     }, {
533         'url': 'https://www.pornhub.com/model/zoe_ph?abc=1',
534         'only_matching': True,
535     }, {
536         # Unavailable via /videos page, but available with direct pagination
537         # on pornstar page (see [1]), requires premium
538         # 1. https://github.com/ytdl-org/youtube-dl/issues/27853
539         'url': 'https://www.pornhubpremium.com/pornstar/sienna-west',
540         'only_matching': True,
541     }, {
542         # Same as before, multi page
543         'url': 'https://www.pornhubpremium.com/pornstar/lily-labeau',
544         'only_matching': True,
545     }]
546
547     def _real_extract(self, url):
548         mobj = re.match(self._VALID_URL, url)
549         user_id = mobj.group('id')
550         videos_url = '%s/videos' % mobj.group('url')
551         page = self._extract_page(url)
552         if page:
553             videos_url = update_url_query(videos_url, {'page': page})
554         return self.url_result(
555             videos_url, ie=PornHubPagedVideoListIE.ie_key(), video_id=user_id)
556
557
558 class PornHubPagedPlaylistBaseIE(PornHubPlaylistBaseIE):
559     @staticmethod
560     def _has_more(webpage):
561         return re.search(
562             r'''(?x)
563                 <li[^>]+\bclass=["\']page_next|
564                 <link[^>]+\brel=["\']next|
565                 <button[^>]+\bid=["\']moreDataBtn
566             ''', webpage) is not None
567
568     def _entries(self, url, host, item_id):
569         page = self._extract_page(url)
570
571         VIDEOS = '/videos'
572
573         def download_page(base_url, num, fallback=False):
574             note = 'Downloading page %d%s' % (num, ' (switch to fallback)' if fallback else '')
575             return self._download_webpage(
576                 base_url, item_id, note, query={'page': num})
577
578         def is_404(e):
579             return isinstance(e.cause, compat_HTTPError) and e.cause.code == 404
580
581         base_url = url
582         has_page = page is not None
583         first_page = page if has_page else 1
584         for page_num in (first_page, ) if has_page else itertools.count(first_page):
585             try:
586                 try:
587                     webpage = download_page(base_url, page_num)
588                 except ExtractorError as e:
589                     # Some sources may not be available via /videos page,
590                     # trying to fallback to main page pagination (see [1])
591                     # 1. https://github.com/ytdl-org/youtube-dl/issues/27853
592                     if is_404(e) and page_num == first_page and VIDEOS in base_url:
593                         base_url = base_url.replace(VIDEOS, '')
594                         webpage = download_page(base_url, page_num, fallback=True)
595                     else:
596                         raise
597             except ExtractorError as e:
598                 if is_404(e) and page_num != first_page:
599                     break
600                 raise
601             page_entries = self._extract_entries(webpage, host)
602             if not page_entries:
603                 break
604             for e in page_entries:
605                 yield e
606             if not self._has_more(webpage):
607                 break
608
609     def _real_extract(self, url):
610         mobj = re.match(self._VALID_URL, url)
611         host = mobj.group('host')
612         item_id = mobj.group('id')
613
614         self._login(host)
615
616         return self.playlist_result(self._entries(url, host, item_id), item_id)
617
618
619 class PornHubPagedVideoListIE(PornHubPagedPlaylistBaseIE):
620     _VALID_URL = r'https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net|org))/(?P<id>(?:[^/]+/)*[^/?#&]+)'
621     _TESTS = [{
622         'url': 'https://www.pornhub.com/model/zoe_ph/videos',
623         'only_matching': True,
624     }, {
625         'url': 'http://www.pornhub.com/users/rushandlia/videos',
626         'only_matching': True,
627     }, {
628         'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos',
629         'info_dict': {
630             'id': 'pornstar/jenny-blighe/videos',
631         },
632         'playlist_mincount': 149,
633     }, {
634         'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos?page=3',
635         'info_dict': {
636             'id': 'pornstar/jenny-blighe/videos',
637         },
638         'playlist_mincount': 40,
639     }, {
640         # default sorting as Top Rated Videos
641         'url': 'https://www.pornhub.com/channels/povd/videos',
642         'info_dict': {
643             'id': 'channels/povd/videos',
644         },
645         'playlist_mincount': 293,
646     }, {
647         # Top Rated Videos
648         'url': 'https://www.pornhub.com/channels/povd/videos?o=ra',
649         'only_matching': True,
650     }, {
651         # Most Recent Videos
652         'url': 'https://www.pornhub.com/channels/povd/videos?o=da',
653         'only_matching': True,
654     }, {
655         # Most Viewed Videos
656         'url': 'https://www.pornhub.com/channels/povd/videos?o=vi',
657         'only_matching': True,
658     }, {
659         'url': 'http://www.pornhub.com/users/zoe_ph/videos/public',
660         'only_matching': True,
661     }, {
662         # Most Viewed Videos
663         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=mv',
664         'only_matching': True,
665     }, {
666         # Top Rated Videos
667         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=tr',
668         'only_matching': True,
669     }, {
670         # Longest Videos
671         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=lg',
672         'only_matching': True,
673     }, {
674         # Newest Videos
675         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos?o=cm',
676         'only_matching': True,
677     }, {
678         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos/paid',
679         'only_matching': True,
680     }, {
681         'url': 'https://www.pornhub.com/pornstar/liz-vicious/videos/fanonly',
682         'only_matching': True,
683     }, {
684         'url': 'https://www.pornhub.com/video',
685         'only_matching': True,
686     }, {
687         'url': 'https://www.pornhub.com/video?page=3',
688         'only_matching': True,
689     }, {
690         'url': 'https://www.pornhub.com/video/search?search=123',
691         'only_matching': True,
692     }, {
693         'url': 'https://www.pornhub.com/categories/teen',
694         'only_matching': True,
695     }, {
696         'url': 'https://www.pornhub.com/categories/teen?page=3',
697         'only_matching': True,
698     }, {
699         'url': 'https://www.pornhub.com/hd',
700         'only_matching': True,
701     }, {
702         'url': 'https://www.pornhub.com/hd?page=3',
703         'only_matching': True,
704     }, {
705         'url': 'https://www.pornhub.com/described-video',
706         'only_matching': True,
707     }, {
708         'url': 'https://www.pornhub.com/described-video?page=2',
709         'only_matching': True,
710     }, {
711         'url': 'https://www.pornhub.com/video/incategories/60fps-1/hd-porn',
712         'only_matching': True,
713     }, {
714         'url': 'https://www.pornhub.com/playlist/44121572',
715         'info_dict': {
716             'id': 'playlist/44121572',
717         },
718         'playlist_mincount': 132,
719     }, {
720         'url': 'https://www.pornhub.com/playlist/4667351',
721         'only_matching': True,
722     }, {
723         'url': 'https://de.pornhub.com/playlist/4667351',
724         'only_matching': True,
725     }]
726
727     @classmethod
728     def suitable(cls, url):
729         return (False
730                 if PornHubIE.suitable(url) or PornHubUserIE.suitable(url) or PornHubUserVideosUploadIE.suitable(url)
731                 else super(PornHubPagedVideoListIE, cls).suitable(url))
732
733
734 class PornHubUserVideosUploadIE(PornHubPagedPlaylistBaseIE):
735     _VALID_URL = r'(?P<url>https?://(?:[^/]+\.)?(?P<host>pornhub(?:premium)?\.(?:com|net|org))/(?:(?:user|channel)s|model|pornstar)/(?P<id>[^/]+)/videos/upload)'
736     _TESTS = [{
737         'url': 'https://www.pornhub.com/pornstar/jenny-blighe/videos/upload',
738         'info_dict': {
739             'id': 'jenny-blighe',
740         },
741         'playlist_mincount': 129,
742     }, {
743         'url': 'https://www.pornhub.com/model/zoe_ph/videos/upload',
744         'only_matching': True,
745     }]