4 from .common
import InfoExtractor
6 compat_urllib_parse_urlparse
,
15 class SpankwireIE(InfoExtractor
):
16 _VALID_URL
= r
'^(?:https?://)?(?:www\.)?(?P<url>spankwire\.com/[^/]*/video(?P<videoid>[0-9]+)/?)'
18 u
'url': u
'http://www.spankwire.com/Buckcherry-s-X-Rated-Music-Video-Crazy-Bitch/video103545/',
19 u
'file': u
'103545.mp4',
20 u
'md5': u
'1b3f55e345500552dbc252a3e9c1af43',
22 u
"uploader": u
"oreusz",
23 u
"title": u
"Buckcherry`s X Rated Music Video Crazy Bitch",
24 u
"description": u
"Crazy Bitch X rated music video.",
29 def _real_extract(self
, url
):
30 mobj
= re
.match(self
._VALID
_URL
, url
)
31 video_id
= mobj
.group('videoid')
32 url
= 'http://www.' + mobj
.group('url')
34 req
= compat_urllib_request
.Request(url
)
35 req
.add_header('Cookie', 'age_verified=1')
36 webpage
= self
._download
_webpage
(req
, video_id
)
38 video_title
= self
._html
_search
_regex
(r
'<h1>([^<]+)', webpage
, u
'title')
39 video_uploader
= self
._html
_search
_regex
(r
'by:\s*<a [^>]*>(.+?)</a>', webpage
, u
'uploader', fatal
=False)
40 thumbnail
= self
._html
_search
_regex
(r
'flashvars\.image_url = "([^"]+)', webpage
, u
'thumbnail', fatal
=False)
41 description
= self
._html
_search
_regex
(r
'>\s*Description:</div>\s*<[^>]*>([^<]+)', webpage
, u
'description', fatal
=False)
42 if len(description
) == 0:
45 video_urls
= list(map(compat_urllib_parse
.unquote
, re
.findall(r
'flashvars\.quality_[0-9]{3}p = "([^"]+)', webpage
)))
46 if webpage
.find('flashvars\.encrypted = "true"') != -1:
47 password
= self
._html
_search
_regex
(r
'flashvars\.video_title = "([^"]+)', webpage
, u
'password').replace('+', ' ')
48 video_urls
= list(map(lambda s
: aes_decrypt_text(s
, password
, 32).decode('utf-8'), video_urls
))
51 for video_url
in video_urls
:
52 path
= compat_urllib_parse_urlparse( video_url
).path
53 extension
= os
.path
.splitext( path
)[1][1:]
54 format
= path
.split('/')[4].split('_')[:2]
55 format
= "-".join( format
)
62 formats
.sort(key
=lambda format
: list(map(lambda s
: s
.zfill(6), format
['format'].split('-'))))
64 age_limit
= self
._rta
_search
(webpage
)
68 'uploader': video_uploader
,
70 'thumbnail': thumbnail
,
71 'description': description
,
73 'age_limit': age_limit
,