]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/eporner.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
17 class EpornerIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?eporner\.com/(?:(?:hd-porn|embed)/|video-)(?P<id>\w+)(?:/(?P<display_id>[\w-]+))?'
20 'url': 'http://www.eporner.com/hd-porn/95008/Infamous-Tiffany-Teen-Strip-Tease-Video/',
21 'md5': '39d486f046212d8e1b911c52ab4691f8',
24 'display_id': 'Infamous-Tiffany-Teen-Strip-Tease-Video',
26 'title': 'Infamous Tiffany Teen Strip Tease Video',
27 'description': 'md5:764f39abf932daafa37485eb46efa152',
28 'timestamp': 1232520922,
29 'upload_date': '20090121',
35 'proxy': '127.0.0.1:8118'
38 # New (May 2016) URL layout
39 'url': 'http://www.eporner.com/hd-porn/3YRUtzMcWn0/Star-Wars-XXX-Parody/',
40 'only_matching': True,
42 'url': 'http://www.eporner.com/hd-porn/3YRUtzMcWn0',
43 'only_matching': True,
45 'url': 'http://www.eporner.com/embed/3YRUtzMcWn0',
46 'only_matching': True,
48 'url': 'https://www.eporner.com/video-FJsA19J3Y3H/one-of-the-greats/',
49 'only_matching': True,
52 def _real_extract(self
, url
):
53 mobj
= self
._match
_valid
_url
(url
)
54 video_id
= mobj
.group('id')
55 display_id
= mobj
.group('display_id') or video_id
57 webpage
, urlh
= self
._download
_webpage
_handle
(url
, display_id
)
59 video_id
= self
._match
_id
(urlh
.geturl())
61 hash = self
._search
_regex
(
62 r
'hash\s*[:=]\s*["\']([\da
-f
]{32}
)', webpage, 'hash')
64 title = self._og_search_title(webpage, default=None) or self._html_search_regex(
65 r'<title
>(.+?
) - EPORNER
', webpage, 'title
')
67 # Reverse engineered from vjs.js
69 return ''.join((encode_base_n(int(s[lb:lb + 8], 16), 36) for lb in range(0, 32, 8)))
71 video = self._download_json(
72 'http
://www
.eporner
.com
/xhr
/video
/%s' % video_id,
73 display_id, note='Downloading video JSON
',
75 'hash': calc_hash(hash),
77 'domain
': 'www
.eporner
.com
',
81 if video.get('available
') is False:
83 '%s said
: %s' % (self.IE_NAME, video['message
']), expected=True)
85 sources = video['sources
']
88 for kind, formats_dict in sources.items():
89 if not isinstance(formats_dict, dict):
91 for format_id, format_dict in formats_dict.items():
92 if not isinstance(format_dict, dict):
94 src = url_or_none(format_dict.get('src
'))
95 if not src or not src.startswith('http
'):
98 formats.extend(self._extract_m3u8_formats(
99 src, display_id, 'mp4
', entry_protocol='m3u8_native
',
100 m3u8_id=kind, fatal=False))
102 height = int_or_none(self._search_regex(
103 r'(\d
+)[pP
]', format_id, 'height
', default=None))
104 fps = int_or_none(self._search_regex(
105 r'(\d
+)fps
', format_id, 'fps
', default=None))
109 'format_id
': format_id,
113 self._sort_formats(formats)
115 json_ld = self._search_json_ld(webpage, display_id, default={})
117 duration = parse_duration(self._html_search_meta(
118 'duration
', webpage, default=None))
119 view_count = str_to_int(self._search_regex(
120 r'id=["\']cinemaviews1["\'][^
>]*>\s
*([0-9,]+)',
121 webpage, 'view count
', default=None))
123 return merge_dicts(json_ld, {
125 'display_id
': display_id,
127 'duration
': duration,
128 'view_count
': view_count,