]>
Commit | Line | Data |
---|---|---|
4cda41ac | 1 | from __future__ import unicode_literals |
2 | ||
4cda41ac | 3 | from .common import InfoExtractor |
e82def52 S |
4 | from ..utils import ( |
5 | parse_iso8601, | |
6 | parse_duration, | |
7 | parse_filesize, | |
8 | int_or_none, | |
9 | ) | |
10 | ||
4cda41ac | 11 | |
12 | class AlphaPornoIE(InfoExtractor): | |
e82def52 | 13 | _VALID_URL = r'https?://(?:www\.)?alphaporno\.com/videos/(?P<id>[^/]+)' |
4cda41ac | 14 | _TEST = { |
15 | 'url': 'http://www.alphaporno.com/videos/sensual-striptease-porn-with-samantha-alexandra/', | |
16 | 'md5': 'feb6d3bba8848cd54467a87ad34bd38e', | |
17 | 'info_dict': { | |
18 | 'id': '258807', | |
e82def52 | 19 | 'display_id': 'sensual-striptease-porn-with-samantha-alexandra', |
4cda41ac | 20 | 'ext': 'mp4', |
e82def52 | 21 | 'title': 'Sensual striptease porn with Samantha Alexandra', |
4cda41ac | 22 | 'thumbnail': 're:https?://.*\.jpg$', |
e82def52 S |
23 | 'timestamp': 1418694611, |
24 | 'upload_date': '20141216', | |
25 | 'duration': 387, | |
26 | 'filesize_approx': 54120000, | |
27 | 'tbr': 1145, | |
28 | 'categories': list, | |
4cda41ac | 29 | 'age_limit': 18, |
30 | } | |
31 | } | |
32 | ||
33 | def _real_extract(self, url): | |
e82def52 | 34 | display_id = self._match_id(url) |
4cda41ac | 35 | |
e82def52 | 36 | webpage = self._download_webpage(url, display_id) |
4cda41ac | 37 | |
e82def52 S |
38 | video_id = self._search_regex( |
39 | r"video_id\s*:\s*'([^']+)'", webpage, 'video id', default=None) | |
4cda41ac | 40 | |
e82def52 S |
41 | video_url = self._search_regex( |
42 | r"video_url\s*:\s*'([^']+)'", webpage, 'video url') | |
43 | ext = self._html_search_meta( | |
44 | 'encodingFormat', webpage, 'ext', default='.mp4')[1:] | |
4cda41ac | 45 | |
e82def52 S |
46 | title = self._search_regex( |
47 | [r'<meta content="([^"]+)" itemprop="description">', | |
48 | r'class="title" itemprop="name">([^<]+)<'], | |
49 | webpage, 'title') | |
50 | thumbnail = self._html_search_meta('thumbnail', webpage, 'thumbnail') | |
51 | timestamp = parse_iso8601(self._html_search_meta( | |
52 | 'uploadDate', webpage, 'upload date')) | |
53 | duration = parse_duration(self._html_search_meta( | |
54 | 'duration', webpage, 'duration')) | |
55 | filesize_approx = parse_filesize(self._html_search_meta( | |
56 | 'contentSize', webpage, 'file size')) | |
57 | bitrate = int_or_none(self._html_search_meta( | |
58 | 'bitrate', webpage, 'bitrate')) | |
59 | categories = self._html_search_meta( | |
60 | 'keywords', webpage, 'categories', default='').split(',') | |
4cda41ac | 61 | |
e82def52 | 62 | age_limit = self._rta_search(webpage) |
4cda41ac | 63 | |
64 | return { | |
65 | 'id': video_id, | |
e82def52 | 66 | 'display_id': display_id, |
4cda41ac | 67 | 'url': video_url, |
4cda41ac | 68 | 'ext': ext, |
e82def52 | 69 | 'title': title, |
4cda41ac | 70 | 'thumbnail': thumbnail, |
e82def52 S |
71 | 'timestamp': timestamp, |
72 | 'duration': duration, | |
73 | 'filesize_approx': filesize_approx, | |
74 | 'tbr': bitrate, | |
4cda41ac | 75 | 'categories': categories, |
e82def52 | 76 | 'age_limit': age_limit, |
4cda41ac | 77 | } |