2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
15 class Vbox7IE(InfoExtractor
):
16 _VALID_URL
= r
'http://(?:www\.)?vbox7\.com/play:(?P<id>[^/]+)'
18 'url': 'http://vbox7.com/play:249bb972c2',
19 'md5': '99f65c0c9ef9b682b97313e052734c3f',
23 'title': 'Смях! Чудо - чист за секунди - Скрита камера',
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
30 # need to get the page 3 times for the correct jsSecretToken cookie
31 # which is necessary for the correct title
33 redirect_page
= self
._download
_webpage
(url
, video_id
)
34 session_id_url
= self
._search
_regex
(
35 r
'var\s*url\s*=\s*\'([^
\']+)\';', redirect_page,
37 self._download_webpage(
38 compat_urlparse.urljoin(url, session_id_url), video_id,
44 webpage = self._download_webpage(url, video_id,
45 'Downloading redirect page
')
47 title = self._html_search_regex(r'<title
>(.*)</title
>',
48 webpage, 'title
').split('/')[0].strip()
50 info_url = 'http
://vbox7
.com
/play
/magare
.do
'
51 data = compat_urllib_parse.urlencode({'as3': '1', 'vid': video_id})
52 info_request = sanitized_Request(info_url, data)
53 info_request.add_header('Content
-Type
', 'application
/x
-www
-form
-urlencoded
')
54 info_response = self._download_webpage(info_request, video_id, 'Downloading info webpage
')
55 if info_response is None:
56 raise ExtractorError('Unable to extract the media url
')
57 (final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&'))
63 'thumbnail
': thumbnail_url,