youporn.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. import itertools
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. ExtractorError,
  6. clean_html,
  7. extract_attributes,
  8. get_element_by_class,
  9. get_element_by_id,
  10. get_elements_html_by_class,
  11. int_or_none,
  12. merge_dicts,
  13. parse_count,
  14. parse_qs,
  15. traverse_obj,
  16. unified_strdate,
  17. url_or_none,
  18. urljoin,
  19. )
  20. class YouPornIE(InfoExtractor):
  21. _VALID_URL = r'https?://(?:www\.)?youporn\.com/(?:watch|embed)/(?P<id>\d+)(?:/(?P<display_id>[^/?#&]+))?/?(?:[#?]|$)'
  22. _EMBED_REGEX = [r'<iframe[^>]+\bsrc=["\'](?P<url>(?:https?:)?//(?:www\.)?youporn\.com/embed/\d+)']
  23. _TESTS = [{
  24. 'url': 'http://www.youporn.com/watch/505835/sex-ed-is-it-safe-to-masturbate-daily/',
  25. 'md5': '3744d24c50438cf5b6f6d59feb5055c2',
  26. 'info_dict': {
  27. 'id': '505835',
  28. 'display_id': 'sex-ed-is-it-safe-to-masturbate-daily',
  29. 'ext': 'mp4',
  30. 'title': 'Sex Ed: Is It Safe To Masturbate Daily?',
  31. 'description': 'Love & Sex Answers: http://bit.ly/DanAndJenn -- Is It Unhealthy To Masturbate Daily?',
  32. 'thumbnail': r're:^https?://.*\.jpg$',
  33. 'duration': 210,
  34. 'uploader': 'Ask Dan And Jennifer',
  35. 'upload_date': '20101217',
  36. 'average_rating': int,
  37. 'view_count': int,
  38. 'categories': list,
  39. 'tags': list,
  40. 'age_limit': 18,
  41. },
  42. 'skip': 'This video has been deactivated',
  43. }, {
  44. # Unknown uploader
  45. 'url': 'http://www.youporn.com/watch/561726/big-tits-awesome-brunette-on-amazing-webcam-show/?from=related3&al=2&from_id=561726&pos=4',
  46. 'info_dict': {
  47. 'id': '561726',
  48. 'display_id': 'big-tits-awesome-brunette-on-amazing-webcam-show',
  49. 'ext': 'mp4',
  50. 'title': 'Big Tits Awesome Brunette On amazing webcam show',
  51. 'description': 'http://sweetlivegirls.com Big Tits Awesome Brunette On amazing webcam show.mp4',
  52. 'thumbnail': r're:^https?://.*\.jpg$',
  53. 'uploader': 'Unknown',
  54. 'upload_date': '20110418',
  55. 'average_rating': int,
  56. 'view_count': int,
  57. 'categories': list,
  58. 'tags': list,
  59. 'age_limit': 18,
  60. },
  61. 'params': {
  62. 'skip_download': True,
  63. },
  64. 'skip': '404',
  65. }, {
  66. 'url': 'https://www.youporn.com/embed/505835/sex-ed-is-it-safe-to-masturbate-daily/',
  67. 'only_matching': True,
  68. }, {
  69. 'url': 'http://www.youporn.com/watch/505835',
  70. 'only_matching': True,
  71. }, {
  72. 'url': 'https://www.youporn.com/watch/13922959/femdom-principal/',
  73. 'only_matching': True,
  74. }, {
  75. 'url': 'https://www.youporn.com/watch/16290308/tinderspecial-trailer1/',
  76. 'info_dict': {
  77. 'id': '16290308',
  78. 'age_limit': 18,
  79. 'categories': [],
  80. 'display_id': 'tinderspecial-trailer1',
  81. 'duration': 298.0,
  82. 'ext': 'mp4',
  83. 'upload_date': '20201123',
  84. 'uploader': 'Ersties',
  85. 'tags': [],
  86. 'thumbnail': r're:https://.+\.jpg',
  87. 'timestamp': 1606147564,
  88. 'title': 'Tinder In Real Life',
  89. 'view_count': int,
  90. },
  91. }]
  92. def _real_extract(self, url):
  93. video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
  94. self._set_cookie('.youporn.com', 'age_verified', '1')
  95. webpage = self._download_webpage(f'https://www.youporn.com/watch/{video_id}', video_id)
  96. watchable = self._search_regex(
  97. r'''(<div\s[^>]*\bid\s*=\s*('|")?watch-container(?(2)\2|(?!-)\b)[^>]*>)''',
  98. webpage, 'watchability', default=None)
  99. if not watchable:
  100. msg = re.split(r'\s{2}', clean_html(get_element_by_id('mainContent', webpage)) or '')[0]
  101. raise ExtractorError(
  102. f'{self.IE_NAME} says: {msg}' if msg else 'Video unavailable', expected=True)
  103. player_vars = self._search_json(r'\bplayervars\s*:', webpage, 'player vars', video_id)
  104. definitions = player_vars['mediaDefinitions']
  105. def get_format_data(data, stream_type):
  106. info_url = traverse_obj(data, (lambda _, v: v['format'] == stream_type, 'videoUrl', {url_or_none}, any))
  107. if not info_url:
  108. return []
  109. return traverse_obj(
  110. self._download_json(info_url, video_id, f'Downloading {stream_type} info JSON', fatal=False),
  111. lambda _, v: v['format'] == stream_type and url_or_none(v['videoUrl']))
  112. formats = []
  113. # Try to extract only the actual master m3u8 first, avoiding the duplicate single resolution "master" m3u8s
  114. for hls_url in traverse_obj(get_format_data(definitions, 'hls'), (
  115. lambda _, v: not isinstance(v['defaultQuality'], bool), 'videoUrl'), (..., 'videoUrl')):
  116. formats.extend(self._extract_m3u8_formats(hls_url, video_id, 'mp4', fatal=False, m3u8_id='hls'))
  117. for definition in get_format_data(definitions, 'mp4'):
  118. f = traverse_obj(definition, {
  119. 'url': 'videoUrl',
  120. 'filesize': ('videoSize', {int_or_none}),
  121. })
  122. height = int_or_none(definition.get('quality'))
  123. # Video URL's path looks like this:
  124. # /201012/17/505835/720p_1500k_505835/YouPorn%20-%20Sex%20Ed%20Is%20It%20Safe%20To%20Masturbate%20Daily.mp4
  125. # /201012/17/505835/vl_240p_240k_505835/YouPorn%20-%20Sex%20Ed%20Is%20It%20Safe%20To%20Masturbate%20Daily.mp4
  126. # /videos/201703/11/109285532/1080P_4000K_109285532.mp4
  127. # We will benefit from it by extracting some metadata
  128. mobj = re.search(r'(?P<height>\d{3,4})[pP]_(?P<bitrate>\d+)[kK]_\d+', definition['videoUrl'])
  129. if mobj:
  130. if not height:
  131. height = int(mobj.group('height'))
  132. bitrate = int(mobj.group('bitrate'))
  133. f.update({
  134. 'format_id': f'{height}p-{bitrate}k',
  135. 'tbr': bitrate,
  136. })
  137. f['height'] = height
  138. formats.append(f)
  139. title = self._html_search_regex(
  140. r'(?s)<div[^>]+class=["\']watchVideoTitle[^>]+>(.+?)</div>',
  141. webpage, 'title', default=None) or self._og_search_title(
  142. webpage, default=None) or self._html_search_meta(
  143. 'title', webpage, fatal=True)
  144. description = self._html_search_regex(
  145. r'(?s)<div[^>]+\bid=["\']description["\'][^>]*>(.+?)</div>',
  146. webpage, 'description',
  147. default=None) or self._og_search_description(
  148. webpage, default=None)
  149. thumbnail = self._search_regex(
  150. r'(?:imageurl\s*=|poster\s*:)\s*(["\'])(?P<thumbnail>.+?)\1',
  151. webpage, 'thumbnail', fatal=False, group='thumbnail')
  152. duration = traverse_obj(player_vars, ('duration', {int_or_none}))
  153. if duration is None:
  154. duration = int_or_none(self._html_search_meta(
  155. 'video:duration', webpage, 'duration', fatal=False))
  156. uploader = self._html_search_regex(
  157. r'(?s)<div[^>]+class=["\']submitByLink["\'][^>]*>(.+?)</div>',
  158. webpage, 'uploader', fatal=False)
  159. upload_date = unified_strdate(self._html_search_regex(
  160. (r'UPLOADED:\s*<span>([^<]+)',
  161. r'Date\s+[Aa]dded:\s*<span>([^<]+)',
  162. r'''(?s)<div[^>]+class=["']videoInfo(?:Date|Time)\b[^>]*>(.+?)</div>''',
  163. r'(?s)<label\b[^>]*>Uploaded[^<]*</label>\s*<span\b[^>]*>(.+?)</span>'),
  164. webpage, 'upload date', fatal=False))
  165. age_limit = self._rta_search(webpage)
  166. view_count = None
  167. views = self._search_regex(
  168. r'(<div [^>]*\bdata-value\s*=[^>]+>)\s*<label>Views:</label>',
  169. webpage, 'views', default=None)
  170. if views:
  171. view_count = parse_count(extract_attributes(views).get('data-value'))
  172. comment_count = parse_count(self._search_regex(
  173. r'>All [Cc]omments? \(([\d,.]+)\)',
  174. webpage, 'comment count', default=None))
  175. def extract_tag_box(regex, title):
  176. tag_box = self._search_regex(regex, webpage, title, default=None)
  177. if not tag_box:
  178. return []
  179. return re.findall(r'<a[^>]+href=[^>]+>([^<]+)', tag_box)
  180. categories = extract_tag_box(
  181. r'(?s)Categories:.*?</[^>]+>(.+?)</div>', 'categories')
  182. tags = extract_tag_box(
  183. r'(?s)Tags:.*?</div>\s*<div[^>]+class=["\']tagBoxContent["\'][^>]*>(.+?)</div>',
  184. 'tags')
  185. data = self._search_json_ld(webpage, video_id, expected_type='VideoObject', fatal=False)
  186. data.pop('url', None)
  187. result = merge_dicts(data, {
  188. 'id': video_id,
  189. 'display_id': display_id,
  190. 'title': title,
  191. 'description': description,
  192. 'thumbnail': thumbnail,
  193. 'duration': duration,
  194. 'uploader': uploader,
  195. 'upload_date': upload_date,
  196. 'view_count': view_count,
  197. 'comment_count': comment_count,
  198. 'categories': categories,
  199. 'tags': tags,
  200. 'age_limit': age_limit,
  201. 'formats': formats,
  202. })
  203. # Remove SEO spam "description"
  204. description = result.get('description')
  205. if description and description.startswith(f'Watch {result.get("title")} online'):
  206. del result['description']
  207. return result
  208. class YouPornListBase(InfoExtractor):
  209. def _get_next_url(self, url, pl_id, html):
  210. return urljoin(url, self._search_regex(
  211. r'''<a [^>]*?\bhref\s*=\s*("|')(?P<url>(?:(?!\1)[^>])+)\1''',
  212. get_element_by_id('next', html) or '', 'next page',
  213. group='url', default=None))
  214. @classmethod
  215. def _get_title_from_slug(cls, title_slug):
  216. return re.sub(r'[_-]', ' ', title_slug)
  217. def _entries(self, url, pl_id, html=None, page_num=None):
  218. start = page_num or 1
  219. for page in itertools.count(start):
  220. if not html:
  221. html = self._download_webpage(
  222. url, pl_id, note=f'Downloading page {page}', fatal=page == start)
  223. if not html:
  224. return
  225. for element in get_elements_html_by_class('video-title', html):
  226. if video_url := traverse_obj(element, ({extract_attributes}, 'href', {lambda x: urljoin(url, x)})):
  227. yield self.url_result(video_url)
  228. if page_num is not None:
  229. return
  230. next_url = self._get_next_url(url, pl_id, html)
  231. if not next_url or next_url == url:
  232. return
  233. url = next_url
  234. html = None
  235. def _real_extract(self, url, html=None):
  236. m_dict = self._match_valid_url(url).groupdict()
  237. pl_id, page_type, sort = (m_dict.get(k) for k in ('id', 'type', 'sort'))
  238. qs = {k: v[-1] for k, v in parse_qs(url).items() if v}
  239. base_id = pl_id or 'YouPorn'
  240. title = self._get_title_from_slug(base_id)
  241. if page_type:
  242. title = f'{page_type.capitalize()} {title}'
  243. base_id = [base_id.lower()]
  244. if sort is None:
  245. title += ' videos'
  246. else:
  247. title = f'{title} videos by {re.sub(r"[_-]", " ", sort)}'
  248. base_id.append(sort)
  249. if qs:
  250. filters = list(map('='.join, sorted(qs.items())))
  251. title += f' ({",".join(filters)})'
  252. base_id.extend(filters)
  253. pl_id = '/'.join(base_id)
  254. return self.playlist_result(
  255. self._entries(url, pl_id, html=html, page_num=int_or_none(qs.get('page'))),
  256. playlist_id=pl_id, playlist_title=title)
  257. class YouPornCategoryIE(YouPornListBase):
  258. IE_DESC = 'YouPorn category, with sorting, filtering and pagination'
  259. _VALID_URL = r'''(?x)
  260. https?://(?:www\.)?youporn\.com/
  261. (?P<type>category)/(?P<id>[^/?#&]+)
  262. (?:/(?P<sort>popular|views|rating|time|duration))?/?(?:[#?]|$)
  263. '''
  264. _TESTS = [{
  265. 'note': 'Full list with pagination',
  266. 'url': 'https://www.youporn.com/category/popular-with-women/popular/',
  267. 'info_dict': {
  268. 'id': 'popular-with-women/popular',
  269. 'title': 'Category popular with women videos by popular',
  270. },
  271. 'playlist_mincount': 39,
  272. }, {
  273. 'note': 'Filtered paginated list with single page result',
  274. 'url': 'https://www.youporn.com/category/popular-with-women/duration/?min_minutes=10',
  275. 'info_dict': {
  276. 'id': 'popular-with-women/duration/min_minutes=10',
  277. 'title': 'Category popular with women videos by duration (min_minutes=10)',
  278. },
  279. 'playlist_mincount': 2,
  280. # 'playlist_maxcount': 30,
  281. }, {
  282. 'note': 'Single page of full list',
  283. 'url': 'https://www.youporn.com/category/popular-with-women/popular?page=1',
  284. 'info_dict': {
  285. 'id': 'popular-with-women/popular/page=1',
  286. 'title': 'Category popular with women videos by popular (page=1)',
  287. },
  288. 'playlist_count': 36,
  289. }]
  290. class YouPornChannelIE(YouPornListBase):
  291. IE_DESC = 'YouPorn channel, with sorting and pagination'
  292. _VALID_URL = r'''(?x)
  293. https?://(?:www\.)?youporn\.com/
  294. (?P<type>channel)/(?P<id>[^/?#&]+)
  295. (?:/(?P<sort>rating|views|duration))?/?(?:[#?]|$)
  296. '''
  297. _TESTS = [{
  298. 'note': 'Full list with pagination',
  299. 'url': 'https://www.youporn.com/channel/x-feeds/',
  300. 'info_dict': {
  301. 'id': 'x-feeds',
  302. 'title': 'Channel X-Feeds videos',
  303. },
  304. 'playlist_mincount': 37,
  305. }, {
  306. 'note': 'Single page of full list (no filters here)',
  307. 'url': 'https://www.youporn.com/channel/x-feeds/duration?page=1',
  308. 'info_dict': {
  309. 'id': 'x-feeds/duration/page=1',
  310. 'title': 'Channel X-Feeds videos by duration (page=1)',
  311. },
  312. 'playlist_count': 24,
  313. }]
  314. @staticmethod
  315. def _get_title_from_slug(title_slug):
  316. return re.sub(r'_', ' ', title_slug).title()
  317. class YouPornCollectionIE(YouPornListBase):
  318. IE_DESC = 'YouPorn collection (user playlist), with sorting and pagination'
  319. _VALID_URL = r'''(?x)
  320. https?://(?:www\.)?youporn\.com/
  321. (?P<type>collection)s/videos/(?P<id>\d+)
  322. (?:/(?P<sort>rating|views|time|duration))?/?(?:[#?]|$)
  323. '''
  324. _TESTS = [{
  325. 'note': 'Full list with pagination',
  326. 'url': 'https://www.youporn.com/collections/videos/33044251/',
  327. 'info_dict': {
  328. 'id': '33044251',
  329. 'title': 'Collection Sexy Lips videos',
  330. 'uploader': 'ph-littlewillyb',
  331. },
  332. 'playlist_mincount': 50,
  333. }, {
  334. 'note': 'Single page of full list (no filters here)',
  335. 'url': 'https://www.youporn.com/collections/videos/33044251/time?page=1',
  336. 'info_dict': {
  337. 'id': '33044251/time/page=1',
  338. 'title': 'Collection Sexy Lips videos by time (page=1)',
  339. 'uploader': 'ph-littlewillyb',
  340. },
  341. 'playlist_count': 20,
  342. }]
  343. def _real_extract(self, url):
  344. pl_id = self._match_id(url)
  345. html = self._download_webpage(url, pl_id)
  346. playlist = super()._real_extract(url, html=html)
  347. infos = re.sub(r'\s+', ' ', clean_html(get_element_by_class(
  348. 'collection-infos', html)) or '')
  349. title, uploader = self._search_regex(
  350. r'^\s*Collection: (?P<title>.+?) \d+ VIDEOS \d+ VIEWS \d+ days LAST UPDATED From: (?P<uploader>[\w_-]+)',
  351. infos, 'title/uploader', group=('title', 'uploader'), default=(None, None))
  352. if title:
  353. playlist.update({
  354. 'title': playlist['title'].replace(playlist['id'].split('/')[0], title),
  355. 'uploader': uploader,
  356. })
  357. return playlist
  358. class YouPornTagIE(YouPornListBase):
  359. IE_DESC = 'YouPorn tag (porntags), with sorting, filtering and pagination'
  360. _VALID_URL = r'''(?x)
  361. https?://(?:www\.)?youporn\.com/
  362. porn(?P<type>tag)s/(?P<id>[^/?#&]+)
  363. (?:/(?P<sort>views|rating|time|duration))?/?(?:[#?]|$)
  364. '''
  365. _TESTS = [{
  366. 'note': 'Full list with pagination',
  367. 'url': 'https://www.youporn.com/porntags/austrian',
  368. 'info_dict': {
  369. 'id': 'austrian',
  370. 'title': 'Tag austrian videos',
  371. },
  372. 'playlist_mincount': 33,
  373. 'expected_warnings': ['YouPorn tag pages are not correctly cached'],
  374. }, {
  375. 'note': 'Filtered paginated list with single page result',
  376. 'url': 'https://www.youporn.com/porntags/austrian/duration/?min_minutes=10',
  377. 'info_dict': {
  378. 'id': 'austrian/duration/min_minutes=10',
  379. 'title': 'Tag austrian videos by duration (min_minutes=10)',
  380. },
  381. 'playlist_mincount': 10,
  382. # number of videos per page is (row x col) 2x3 + 6x4 + 2, or + 3,
  383. # or more, varying with number of ads; let's set max as 9x4
  384. # NB col 1 may not be shown in non-JS page with site CSS and zoom 100%
  385. # 'playlist_maxcount': 32,
  386. 'expected_warnings': ['YouPorn tag pages are not correctly cached'],
  387. }, {
  388. 'note': 'Single page of full list',
  389. 'url': 'https://www.youporn.com/porntags/austrian/?page=1',
  390. 'info_dict': {
  391. 'id': 'austrian/page=1',
  392. 'title': 'Tag austrian videos (page=1)',
  393. },
  394. 'playlist_mincount': 32,
  395. # 'playlist_maxcount': 34,
  396. 'expected_warnings': ['YouPorn tag pages are not correctly cached'],
  397. }]
  398. def _real_extract(self, url):
  399. self.report_warning(
  400. 'YouPorn tag pages are not correctly cached and '
  401. 'often return incorrect results', only_once=True)
  402. return super()._real_extract(url)
  403. class YouPornStarIE(YouPornListBase):
  404. IE_DESC = 'YouPorn Pornstar, with description, sorting and pagination'
  405. _VALID_URL = r'''(?x)
  406. https?://(?:www\.)?youporn\.com/
  407. (?P<type>pornstar)/(?P<id>[^/?#&]+)
  408. (?:/(?P<sort>rating|views|duration))?/?(?:[#?]|$)
  409. '''
  410. _TESTS = [{
  411. 'note': 'Full list with pagination',
  412. 'url': 'https://www.youporn.com/pornstar/daynia/',
  413. 'info_dict': {
  414. 'id': 'daynia',
  415. 'title': 'Pornstar Daynia videos',
  416. 'description': r're:Daynia Rank \d+ Videos \d+ Views [\d,.]+ .+ Subscribers \d+',
  417. },
  418. 'playlist_mincount': 40,
  419. }, {
  420. 'note': 'Single page of full list (no filters here)',
  421. 'url': 'https://www.youporn.com/pornstar/daynia/?page=1',
  422. 'info_dict': {
  423. 'id': 'daynia/page=1',
  424. 'title': 'Pornstar Daynia videos (page=1)',
  425. 'description': 're:.{180,}',
  426. },
  427. 'playlist_count': 26,
  428. }]
  429. @staticmethod
  430. def _get_title_from_slug(title_slug):
  431. return re.sub(r'_', ' ', title_slug).title()
  432. def _real_extract(self, url):
  433. pl_id = self._match_id(url)
  434. html = self._download_webpage(url, pl_id)
  435. playlist = super()._real_extract(url, html=html)
  436. INFO_ELEMENT_RE = r'''(?x)
  437. <div [^>]*\bclass\s*=\s*('|")(?:[\w$-]+\s+|\s)*?pornstar-info-wrapper(?:\s+[\w$-]+|\s)*\1[^>]*>
  438. (?P<info>[\s\S]+?)(?:</div>\s*){6,}
  439. '''
  440. if infos := self._search_regex(INFO_ELEMENT_RE, html, 'infos', group='info', default=''):
  441. infos = re.sub(
  442. r'(?:\s*nl=nl)+\s*', ' ',
  443. re.sub(r'(?u)\s+', ' ', clean_html(re.sub('\n', 'nl=nl', infos)))).replace('ribe Subsc', '')
  444. return {
  445. **playlist,
  446. 'description': infos.strip() or None,
  447. }
  448. class YouPornVideosIE(YouPornListBase):
  449. IE_DESC = 'YouPorn video (browse) playlists, with sorting, filtering and pagination'
  450. _VALID_URL = r'''(?x)
  451. https?://(?:www\.)?youporn\.com/
  452. (?:(?P<id>browse)/)?
  453. (?P<sort>(?(id)
  454. (?:duration|rating|time|views)|
  455. (?:most_(?:favou?rit|view)ed|recommended|top_rated)?))
  456. (?:[/#?]|$)
  457. '''
  458. _TESTS = [{
  459. 'note': 'Full list with pagination (too long for test)',
  460. 'url': 'https://www.youporn.com/',
  461. 'info_dict': {
  462. 'id': 'youporn',
  463. 'title': 'YouPorn videos',
  464. },
  465. 'only_matching': True,
  466. }, {
  467. 'note': 'Full list with pagination (too long for test)',
  468. 'url': 'https://www.youporn.com/recommended',
  469. 'info_dict': {
  470. 'id': 'youporn/recommended',
  471. 'title': 'YouPorn videos by recommended',
  472. },
  473. 'only_matching': True,
  474. }, {
  475. 'note': 'Full list with pagination (too long for test)',
  476. 'url': 'https://www.youporn.com/top_rated',
  477. 'info_dict': {
  478. 'id': 'youporn/top_rated',
  479. 'title': 'YouPorn videos by top rated',
  480. },
  481. 'only_matching': True,
  482. }, {
  483. 'note': 'Full list with pagination (too long for test)',
  484. 'url': 'https://www.youporn.com/browse/time',
  485. 'info_dict': {
  486. 'id': 'browse/time',
  487. 'title': 'YouPorn videos by time',
  488. },
  489. 'only_matching': True,
  490. }, {
  491. 'note': 'Filtered paginated list with single page result',
  492. 'url': 'https://www.youporn.com/most_favorited/?res=VR&max_minutes=2',
  493. 'info_dict': {
  494. 'id': 'youporn/most_favorited/max_minutes=2/res=VR',
  495. 'title': 'YouPorn videos by most favorited (max_minutes=2,res=VR)',
  496. },
  497. 'playlist_mincount': 10,
  498. # 'playlist_maxcount': 28,
  499. }, {
  500. 'note': 'Filtered paginated list with several pages',
  501. 'url': 'https://www.youporn.com/most_favorited/?res=VR&max_minutes=5',
  502. 'info_dict': {
  503. 'id': 'youporn/most_favorited/max_minutes=5/res=VR',
  504. 'title': 'YouPorn videos by most favorited (max_minutes=5,res=VR)',
  505. },
  506. 'playlist_mincount': 45,
  507. }, {
  508. 'note': 'Single page of full list',
  509. 'url': 'https://www.youporn.com/browse/time?page=1',
  510. 'info_dict': {
  511. 'id': 'browse/time/page=1',
  512. 'title': 'YouPorn videos by time (page=1)',
  513. },
  514. 'playlist_count': 36,
  515. }]
  516. @staticmethod
  517. def _get_title_from_slug(title_slug):
  518. return 'YouPorn' if title_slug == 'browse' else title_slug