3 from .common
import InfoExtractor
4 from ..aes
import aes_decrypt_text
5 from ..compat
import compat_urllib_parse_unquote
16 class KeezMoviesIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?keezmovies\.com/video/(?:(?P<display_id>[^/]+)-)?(?P<id>\d+)'
19 'url': 'https://www.keezmovies.com/video/arab-wife-want-it-so-bad-i-see-she-thirsty-and-has-tiny-money-18070681',
20 'md5': '2ac69cdb882055f71d82db4311732a1a',
23 'display_id': 'arab-wife-want-it-so-bad-i-see-she-thirsty-and-has-tiny-money',
25 'title': 'Arab wife want it so bad I see she thirsty and has tiny money.',
31 'url': 'http://www.keezmovies.com/video/18070681',
32 'only_matching': True,
35 def _extract_info(self
, url
, fatal
=True):
36 mobj
= self
._match
_valid
_url
(url
)
37 video_id
= mobj
.group('id')
38 display_id
= (mobj
.group('display_id')
39 if 'display_id' in mobj
.groupdict()
40 else None) or mobj
.group('id')
42 webpage
= self
._download
_webpage
(
43 url
, display_id
, headers
={'Cookie': 'age_verified=1'}
)
53 def extract_format(format_url
, height
=None):
54 format_url
= url_or_none(format_url
)
55 if not format_url
or not format_url
.startswith(('http', '//')):
57 if format_url
in format_urls
:
59 format_urls
.add(format_url
)
60 tbr
= int_or_none(self
._search
_regex
(
61 r
'[/_](\d+)[kK][/_]', format_url
, 'tbr', default
=None))
63 height
= int_or_none(self
._search
_regex
(
64 r
'[/_](\d+)[pP][/_]', format_url
, 'height', default
=None))
66 format_url
= aes_decrypt_text(
67 video_url
, title
, 32).decode('utf-8')
70 'format_id': format_field(height
, None, '%dp'),
75 flashvars
= self
._parse
_json
(
77 r
'flashvars\s*=\s*({.+?});', webpage
,
78 'flashvars', default
='{}'),
79 display_id
, fatal
=False)
82 title
= flashvars
.get('video_title')
83 thumbnail
= flashvars
.get('image_url')
84 duration
= int_or_none(flashvars
.get('video_duration'))
85 encrypted
= flashvars
.get('encrypted') is True
86 for key
, value
in flashvars
.items():
87 mobj
= re
.search(r
'quality_(\d+)[pP]', key
)
89 extract_format(value
, int(mobj
.group(1)))
90 video_url
= flashvars
.get('video_url')
91 if video_url
and determine_ext(video_url
, None):
92 extract_format(video_url
)
94 video_url
= self
._html
_search
_regex
(
95 r
'flashvars\.video_url\s*=\s*(["\'])(?P
<url
>http
.+?
)\
1',
96 webpage, 'video url
', default=None, group='url
')
98 extract_format(compat_urllib_parse_unquote(video_url))
101 if 'title
="This video is no longer available"' in webpage:
102 self.raise_no_formats(
103 'Video
%s is no longer available
' % video_id, expected=True)
106 title = self._html_search_regex(
107 r'<h1
[^
>]*>([^
<]+)', webpage, 'title
')
111 'display_id
': display_id,
112 'title
': strip_or_none(title),
113 'thumbnail
': thumbnail,
114 'duration
': duration,
119 def _real_extract(self, url):
120 webpage, info = self._extract_info(url, fatal=False)
121 if not info['formats
']:
122 return self.url_result(url, 'Generic
')
123 info['view_count
'] = str_to_int(self._search_regex(
124 r'<b
>([\d
,.]+)</b
> Views?
', webpage, 'view count
', fatal=False))