3 from .common
import InfoExtractor
4 from ..aes
import aes_decrypt_text
5 from ..compat
import compat_urllib_parse_unquote
17 class KeezMoviesIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?keezmovies\.com/video/(?:(?P<display_id>[^/]+)-)?(?P<id>\d+)'
20 'url': 'https://www.keezmovies.com/video/arab-wife-want-it-so-bad-i-see-she-thirsty-and-has-tiny-money-18070681',
21 'md5': '2ac69cdb882055f71d82db4311732a1a',
24 'display_id': 'arab-wife-want-it-so-bad-i-see-she-thirsty-and-has-tiny-money',
26 'title': 'Arab wife want it so bad I see she thirsty and has tiny money.',
32 'url': 'http://www.keezmovies.com/video/18070681',
33 'only_matching': True,
36 def _extract_info(self
, url
, fatal
=True):
37 mobj
= self
._match
_valid
_url
(url
)
38 video_id
= mobj
.group('id')
39 display_id
= (mobj
.group('display_id')
40 if 'display_id' in mobj
.groupdict()
41 else None) or mobj
.group('id')
43 webpage
= self
._download
_webpage
(
44 url
, display_id
, headers
={'Cookie': 'age_verified=1'}
)
54 def extract_format(format_url
, height
=None):
55 format_url
= url_or_none(format_url
)
56 if not format_url
or not format_url
.startswith(('http', '//')):
58 if format_url
in format_urls
:
60 format_urls
.add(format_url
)
61 tbr
= int_or_none(self
._search
_regex
(
62 r
'[/_](\d+)[kK][/_]', format_url
, 'tbr', default
=None))
64 height
= int_or_none(self
._search
_regex
(
65 r
'[/_](\d+)[pP][/_]', format_url
, 'height', default
=None))
67 format_url
= aes_decrypt_text(
68 video_url
, title
, 32).decode('utf-8')
71 'format_id': format_field(height
, None, '%dp'),
76 flashvars
= self
._parse
_json
(
78 r
'flashvars\s*=\s*({.+?});', webpage
,
79 'flashvars', default
='{}'),
80 display_id
, fatal
=False)
83 title
= flashvars
.get('video_title')
84 thumbnail
= flashvars
.get('image_url')
85 duration
= int_or_none(flashvars
.get('video_duration'))
86 encrypted
= flashvars
.get('encrypted') is True
87 for key
, value
in flashvars
.items():
88 mobj
= re
.search(r
'quality_(\d+)[pP]', key
)
90 extract_format(value
, int(mobj
.group(1)))
91 video_url
= flashvars
.get('video_url')
92 if video_url
and determine_ext(video_url
, None):
93 extract_format(video_url
)
95 video_url
= self
._html
_search
_regex
(
96 r
'flashvars\.video_url\s*=\s*(["\'])(?P
<url
>http
.+?
)\
1',
97 webpage, 'video url
', default=None, group='url
')
99 extract_format(compat_urllib_parse_unquote(video_url))
102 if 'title
="This video is no longer available"' in webpage:
103 self.raise_no_formats(
104 'Video
%s is no longer available
' % video_id, expected=True)
107 self._sort_formats(formats)
108 except ExtractorError:
113 title = self._html_search_regex(
114 r'<h1
[^
>]*>([^
<]+)', webpage, 'title
')
118 'display_id
': display_id,
119 'title
': strip_or_none(title),
120 'thumbnail
': thumbnail,
121 'duration
': duration,
126 def _real_extract(self, url):
127 webpage, info = self._extract_info(url, fatal=False)
128 if not info['formats
']:
129 return self.url_result(url, 'Generic
')
130 info['view_count
'] = str_to_int(self._search_regex(
131 r'<b
>([\d
,.]+)</b
> Views?
', webpage, 'view count
', fatal=False))