]>
Commit | Line | Data |
---|---|---|
43df5a7e JMF |
1 | from __future__ import unicode_literals |
2 | ||
5b11143d | 3 | import os |
4 | import re | |
5 | ||
6 | from .common import InfoExtractor | |
1cc79574 | 7 | from ..compat import ( |
5b11143d | 8 | compat_urllib_parse_urlparse, |
9 | compat_urllib_request, | |
10 | compat_urllib_parse, | |
5b11143d | 11 | ) |
12 | from ..aes import ( | |
13 | aes_decrypt_text | |
14 | ) | |
15 | ||
43df5a7e | 16 | |
5b11143d | 17 | class KeezMoviesIE(InfoExtractor): |
1cc79574 | 18 | _VALID_URL = r'https?://(?:www\.)?keezmovies\.com/video/.+?(?P<id>[0-9]+)(?:[/?&]|$)' |
5b11143d | 19 | _TEST = { |
43df5a7e JMF |
20 | 'url': 'http://www.keezmovies.com/video/petite-asian-lady-mai-playing-in-bathtub-1214711', |
21 | 'file': '1214711.mp4', | |
22 | 'md5': '6e297b7e789329923fcf83abb67c9289', | |
23 | 'info_dict': { | |
24 | 'title': 'Petite Asian Lady Mai Playing In Bathtub', | |
25 | 'age_limit': 18, | |
5b11143d | 26 | } |
27 | } | |
28 | ||
29 | def _real_extract(self, url): | |
1cc79574 | 30 | video_id = self._match_id(url) |
5b11143d | 31 | |
32 | req = compat_urllib_request.Request(url) | |
33 | req.add_header('Cookie', 'age_verified=1') | |
34 | webpage = self._download_webpage(req, video_id) | |
35 | ||
36 | # embedded video | |
37 | mobj = re.search(r'href="([^"]+)"></iframe>', webpage) | |
38 | if mobj: | |
39 | embedded_url = mobj.group(1) | |
5da05495 | 40 | return self.url_result(embedded_url) |
5b11143d | 41 | |
43df5a7e JMF |
42 | video_title = self._html_search_regex(r'<h1 [^>]*>([^<]+)', webpage, 'title') |
43 | video_url = compat_urllib_parse.unquote(self._html_search_regex(r'video_url=(.+?)&', webpage, 'video_url')) | |
44 | if 'encrypted=true' in webpage: | |
45 | password = self._html_search_regex(r'video_title=(.+?)&', webpage, 'password') | |
5b11143d | 46 | video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8') |
a56f9de1 JMF |
47 | path = compat_urllib_parse_urlparse(video_url).path |
48 | extension = os.path.splitext(path)[1][1:] | |
5b11143d | 49 | format = path.split('/')[4].split('_')[:2] |
a56f9de1 | 50 | format = "-".join(format) |
5b11143d | 51 | |
750e9833 FV |
52 | age_limit = self._rta_search(webpage) |
53 | ||
5b11143d | 54 | return { |
55 | 'id': video_id, | |
56 | 'title': video_title, | |
57 | 'url': video_url, | |
58 | 'ext': extension, | |
59 | 'format': format, | |
60 | 'format_id': format, | |
750e9833 | 61 | 'age_limit': age_limit, |
5b11143d | 62 | } |