]>
Commit | Line | Data |
---|---|---|
1d57b252 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
5 | ||
6 | from .common import InfoExtractor | |
48d4681e PH |
7 | from ..utils import ( |
8 | parse_duration, | |
9 | str_to_int, | |
10 | ) | |
11 | ||
1d57b252 | 12 | |
13 | class EpornerIE(InfoExtractor): | |
48d4681e | 14 | _VALID_URL = r'https?://(?:www\.)?eporner\.com/hd-porn/(?P<id>\d+)/(?P<title_dash>[\w-]+)/?' |
1d57b252 | 15 | _TEST = { |
16 | 'url': 'http://www.eporner.com/hd-porn/95008/Infamous-Tiffany-Teen-Strip-Tease-Video/', | |
17 | 'md5': '3b427ae4b9d60619106de3185c2987cd', | |
18 | 'info_dict': { | |
19 | 'id': '95008', | |
20 | 'ext': 'flv', | |
21 | 'title': 'Infamous Tiffany Teen Strip Tease Video', | |
48d4681e PH |
22 | 'duration': 194, |
23 | 'view_count': int, | |
1d57b252 | 24 | } |
25 | } | |
26 | ||
27 | def _real_extract(self, url): | |
28 | mobj = re.match(self._VALID_URL, url) | |
29 | video_id = mobj.group('id') | |
30 | webpage = self._download_webpage(url, video_id) | |
48d4681e PH |
31 | title = self._html_search_regex( |
32 | r'<title>(.*?) - EPORNER', webpage, 'title') | |
1d57b252 | 33 | |
48d4681e PH |
34 | redirect_code = self._html_search_regex( |
35 | r'<script type="text/javascript" src="/config5/%s/([a-f\d]+)/">' % video_id, | |
36 | webpage, 'redirect_code') | |
37 | redirect_url = 'http://www.eporner.com/config5/%s/%s' % (video_id, redirect_code) | |
1d57b252 | 38 | webpage2 = self._download_webpage(redirect_url, video_id) |
48d4681e PH |
39 | video_url = self._html_search_regex( |
40 | r'file: "(.*?)",', webpage2, 'video_url') | |
1d57b252 | 41 | |
48d4681e PH |
42 | duration = parse_duration(self._search_regex( |
43 | r'class="mbtim">([0-9:]+)</div>', webpage, 'duration', | |
44 | fatal=False)) | |
45 | view_count = str_to_int(self._search_regex( | |
46 | r'id="cinemaviews">\s*([0-9,]+)\s*<small>views', | |
47 | webpage, 'view count', fatal=False)) | |
1d57b252 | 48 | |
49 | return { | |
50 | 'id': video_id, | |
51 | 'url': video_url, | |
52 | 'title': title, | |
48d4681e PH |
53 | 'duration': duration, |
54 | 'view_count': view_count, | |
1d57b252 | 55 | } |