]>
Commit | Line | Data |
---|---|---|
72c65d39 | 1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
35241d05 S |
6 | from ..utils import ( |
7 | parse_duration, | |
8 | int_or_none, | |
9 | ) | |
10 | ||
72c65d39 | 11 | |
12 | class AnySexIE(InfoExtractor): | |
35241d05 | 13 | _VALID_URL = r'https?://(?:www\.)?anysex\.com/(?P<id>\d+)' |
72c65d39 | 14 | _TEST = { |
15 | 'url': 'http://anysex.com/156592/', | |
16 | 'md5': '023e9fbb7f7987f5529a394c34ad3d3d', | |
17 | 'info_dict': { | |
18 | 'id': '156592', | |
19 | 'ext': 'mp4', | |
20 | 'title': 'Busty and sexy blondie in her bikini strips for you', | |
35241d05 S |
21 | 'description': 'md5:de9e418178e2931c10b62966474e1383', |
22 | 'categories': ['Erotic'], | |
0bafcf6f | 23 | 'duration': 270, |
11342b54 | 24 | 'age_limit': 18, |
72c65d39 | 25 | } |
26 | } | |
27 | ||
28 | def _real_extract(self, url): | |
29 | mobj = re.match(self._VALID_URL, url) | |
30 | video_id = mobj.group('id') | |
31 | ||
32 | webpage = self._download_webpage(url, video_id) | |
35241d05 S |
33 | |
34 | video_url = self._html_search_regex(r"video_url\s*:\s*'([^']+)'", webpage, 'video URL') | |
35 | ||
72c65d39 | 36 | title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title') |
35241d05 S |
37 | description = self._html_search_regex( |
38 | r'<div class="description">([^<]+)</div>', webpage, 'description', fatal=False) | |
39 | thumbnail = self._html_search_regex( | |
40 | r'preview_url\s*:\s*\'(.*?)\'', webpage, 'thumbnail', fatal=False) | |
72c65d39 | 41 | |
35241d05 S |
42 | categories = re.findall( |
43 | r'<a href="http://anysex\.com/categories/[^"]+" title="[^"]*">([^<]+)</a>', webpage) | |
72c65d39 | 44 | |
35241d05 S |
45 | duration = parse_duration(self._search_regex( |
46 | r'<b>Duration:</b> (\d+:\d+)', webpage, 'duration', fatal=False)) | |
35241d05 S |
47 | view_count = int_or_none(self._html_search_regex( |
48 | r'<b>Views:</b> (\d+)', webpage, 'view count', fatal=False)) | |
72c65d39 | 49 | |
50 | return { | |
51 | 'id': video_id, | |
72c65d39 | 52 | 'url': video_url, |
35241d05 | 53 | 'ext': 'mp4', |
72c65d39 | 54 | 'title': title, |
35241d05 S |
55 | 'description': description, |
56 | 'thumbnail': thumbnail, | |
57 | 'categories': categories, | |
58 | 'duration': duration, | |
59 | 'view_count': view_count, | |
11342b54 | 60 | 'age_limit': 18, |
72c65d39 | 61 | } |