]>
Commit | Line | Data |
---|---|---|
6a1c4fbf | 1 | from __future__ import unicode_literals |
355e4146 | 2 | |
6a1c4fbf | 3 | from .common import InfoExtractor |
355e4146 | 4 | from ..utils import ( |
73453430 S |
5 | int_or_none, |
6 | merge_dicts, | |
355e4146 | 7 | remove_end, |
73453430 | 8 | unified_timestamp, |
355e4146 | 9 | ) |
6a1c4fbf | 10 | |
513fd2a8 | 11 | |
6a1c4fbf | 12 | class HellPornoIE(InfoExtractor): |
868630fb AS |
13 | _VALID_URL = r'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P<id>[^/]+)' |
14 | _TESTS = [{ | |
6a1c4fbf | 15 | 'url': 'http://hellporno.com/videos/dixie-is-posing-with-naked-ass-very-erotic/', |
73453430 | 16 | 'md5': 'f0a46ebc0bed0c72ae8fe4629f7de5f3', |
6a1c4fbf | 17 | 'info_dict': { |
18 | 'id': '149116', | |
513fd2a8 | 19 | 'display_id': 'dixie-is-posing-with-naked-ass-very-erotic', |
6a1c4fbf | 20 | 'ext': 'mp4', |
21 | 'title': 'Dixie is posing with naked ass very erotic', | |
73453430 S |
22 | 'description': 'md5:9a72922749354edb1c4b6e540ad3d215', |
23 | 'categories': list, | |
ec85ded8 | 24 | 'thumbnail': r're:https?://.*\.jpg$', |
73453430 S |
25 | 'duration': 240, |
26 | 'timestamp': 1398762720, | |
27 | 'upload_date': '20140429', | |
28 | 'view_count': int, | |
6a1c4fbf | 29 | 'age_limit': 18, |
73453430 | 30 | }, |
868630fb AS |
31 | }, { |
32 | 'url': 'http://hellporno.net/v/186271/', | |
33 | 'only_matching': True, | |
34 | }] | |
6a1c4fbf | 35 | |
36 | def _real_extract(self, url): | |
513fd2a8 | 37 | display_id = self._match_id(url) |
6a1c4fbf | 38 | |
355e4146 | 39 | webpage = self._download_webpage(url, display_id) |
6a1c4fbf | 40 | |
355e4146 S |
41 | title = remove_end(self._html_search_regex( |
42 | r'<title>([^<]+)</title>', webpage, 'title'), ' - Hell Porno') | |
6a1c4fbf | 43 | |
73453430 S |
44 | info = self._parse_html5_media_entries(url, webpage, display_id)[0] |
45 | self._sort_formats(info['formats']) | |
6a1c4fbf | 46 | |
73453430 S |
47 | video_id = self._search_regex( |
48 | (r'chs_object\s*=\s*["\'](\d+)', | |
49 | r'params\[["\']video_id["\']\]\s*=\s*(\d+)'), webpage, 'video id', | |
50 | default=display_id) | |
51 | description = self._search_regex( | |
52 | r'class=["\']desc_video_view_v2[^>]+>([^<]+)', webpage, | |
53 | 'description', fatal=False) | |
54 | categories = [ | |
55 | c.strip() | |
56 | for c in self._html_search_meta( | |
57 | 'keywords', webpage, 'categories', default='').split(',') | |
58 | if c.strip()] | |
59 | duration = int_or_none(self._og_search_property( | |
60 | 'video:duration', webpage, fatal=False)) | |
61 | timestamp = unified_timestamp(self._og_search_property( | |
62 | 'video:release_date', webpage, fatal=False)) | |
63 | view_count = int_or_none(self._search_regex( | |
64 | r'>Views\s+(\d+)', webpage, 'view count', fatal=False)) | |
6a1c4fbf | 65 | |
73453430 | 66 | return merge_dicts(info, { |
6a1c4fbf | 67 | 'id': video_id, |
513fd2a8 | 68 | 'display_id': display_id, |
6a1c4fbf | 69 | 'title': title, |
73453430 | 70 | 'description': description, |
6a1c4fbf | 71 | 'categories': categories, |
73453430 S |
72 | 'duration': duration, |
73 | 'timestamp': timestamp, | |
74 | 'view_count': view_count, | |
6a1c4fbf | 75 | 'age_limit': 18, |
73453430 | 76 | }) |