]>
Commit | Line | Data |
---|---|---|
0cc4f8e3 | 1 | from __future__ import unicode_literals |
2 | ||
0cc4f8e3 | 3 | |
4 | from .common import InfoExtractor | |
5 | from ..utils import ( | |
6 | parse_duration, | |
7 | int_or_none, | |
8 | ) | |
9 | ||
10 | ||
11 | class XXXYMoviesIE(InfoExtractor): | |
12 | _VALID_URL = r'https?://(?:www\.)?xxxymovies\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)' | |
13 | _TEST = { | |
14 | 'url': 'http://xxxymovies.com/videos/138669/ecstatic-orgasm-sofcore/', | |
15 | 'md5': '810b1bdbbffff89dd13bdb369fe7be4b', | |
16 | 'info_dict': { | |
17 | 'id': '138669', | |
18 | 'display_id': 'ecstatic-orgasm-sofcore', | |
19 | 'ext': 'mp4', | |
20 | 'title': 'Ecstatic Orgasm Sofcore', | |
21 | 'duration': 931, | |
6343a5f6 S |
22 | 'categories': list, |
23 | 'view_count': int, | |
24 | 'like_count': int, | |
25 | 'dislike_count': int, | |
0cc4f8e3 | 26 | 'age_limit': 18, |
27 | } | |
28 | } | |
29 | ||
30 | def _real_extract(self, url): | |
5ad28e7f | 31 | mobj = self._match_valid_url(url) |
0cc4f8e3 | 32 | video_id = mobj.group('id') |
33 | display_id = mobj.group('display_id') | |
34 | ||
6343a5f6 | 35 | webpage = self._download_webpage(url, display_id) |
0cc4f8e3 | 36 | |
6343a5f6 | 37 | video_url = self._search_regex( |
0cc4f8e3 | 38 | r"video_url\s*:\s*'([^']+)'", webpage, 'video URL') |
39 | ||
40 | title = self._html_search_regex( | |
baba5f4d S |
41 | [r'<div[^>]+\bclass="block_header"[^>]*>\s*<h1>([^<]+)<', |
42 | r'<title>(.*?)\s*-\s*(?:XXXYMovies\.com|XXX\s+Movies)</title>'], | |
6343a5f6 | 43 | webpage, 'title') |
0cc4f8e3 | 44 | |
6343a5f6 S |
45 | thumbnail = self._search_regex( |
46 | r"preview_url\s*:\s*'([^']+)'", | |
47 | webpage, 'thumbnail', fatal=False) | |
0cc4f8e3 | 48 | |
49 | categories = self._html_search_meta( | |
50 | 'keywords', webpage, 'categories', default='').split(',') | |
51 | ||
52 | duration = parse_duration(self._search_regex( | |
6343a5f6 S |
53 | r'<span>Duration:</span>\s*(\d+:\d+)', |
54 | webpage, 'duration', fatal=False)) | |
0cc4f8e3 | 55 | |
56 | view_count = int_or_none(self._html_search_regex( | |
6343a5f6 S |
57 | r'<div class="video_views">\s*(\d+)', |
58 | webpage, 'view count', fatal=False)) | |
59 | like_count = int_or_none(self._search_regex( | |
60 | r'>\s*Likes? <b>\((\d+)\)', | |
61 | webpage, 'like count', fatal=False)) | |
62 | dislike_count = int_or_none(self._search_regex( | |
63 | r'>\s*Dislike <b>\((\d+)\)</b>', | |
64 | webpage, 'dislike count', fatal=False)) | |
65 | ||
66 | age_limit = self._rta_search(webpage) | |
0cc4f8e3 | 67 | |
68 | return { | |
69 | 'id': video_id, | |
70 | 'display_id': display_id, | |
71 | 'url': video_url, | |
72 | 'title': title, | |
73 | 'thumbnail': thumbnail, | |
74 | 'categories': categories, | |
75 | 'duration': duration, | |
76 | 'view_count': view_count, | |
6343a5f6 S |
77 | 'like_count': like_count, |
78 | 'dislike_count': dislike_count, | |
79 | 'age_limit': age_limit, | |
0cc4f8e3 | 80 | } |