]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/pornoxo.py
[cleanup,youtube] Reorganize Tab and Search extractor inheritances
[yt-dlp.git] / yt_dlp / extractor / pornoxo.py
1 from __future__ import unicode_literals
2
3
4 from .common import InfoExtractor
5 from ..utils import (
6 str_to_int,
7 )
8
9
10 class PornoXOIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html'
12 _TEST = {
13 'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html',
14 'md5': '582f28ecbaa9e6e24cb90f50f524ce87',
15 'info_dict': {
16 'id': '7564',
17 'ext': 'flv',
18 'title': 'Striptease From Sexy Secretary!',
19 'display_id': 'striptease-from-sexy-secretary',
20 'description': 'md5:0ee35252b685b3883f4a1d38332f9980',
21 'categories': list, # NSFW
22 'thumbnail': r're:https?://.*\.jpg$',
23 'age_limit': 18,
24 }
25 }
26
27 def _real_extract(self, url):
28 mobj = self._match_valid_url(url)
29 video_id, display_id = mobj.groups()
30
31 webpage = self._download_webpage(url, video_id)
32 video_data = self._extract_jwplayer_data(webpage, video_id, require_title=False)
33
34 title = self._html_search_regex(
35 r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title')
36
37 view_count = str_to_int(self._html_search_regex(
38 r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False))
39
40 categories_str = self._html_search_regex(
41 r'<meta name="description" content=".*featuring\s*([^"]+)"',
42 webpage, 'categories', fatal=False)
43 categories = (
44 None if categories_str is None
45 else categories_str.split(','))
46
47 video_data.update({
48 'id': video_id,
49 'title': title,
50 'display_id': display_id,
51 'description': self._html_search_meta('description', webpage),
52 'categories': categories,
53 'view_count': view_count,
54 'age_limit': 18,
55 })
56
57 return video_data