2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..utils import urlencode_postdata
8 class Vbox7IE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?vbox7\.com/play:(?P<id>[^/]+)'
11 'url': 'http://vbox7.com/play:0946fff23c',
12 'md5': 'a60f9ab3a3a2f013ef9a967d5f7be5bf',
16 'title': 'Борисов: Притеснен съм за бъдещето на България',
19 'url': 'http://vbox7.com/play:249bb972c2',
20 'md5': '99f65c0c9ef9b682b97313e052734c3f',
24 'title': 'Смях! Чудо - чист за секунди - Скрита камера',
26 'skip': 'georestricted',
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
32 webpage = self._download_webpage(url, video_id)
34 title = self._html_search_regex(
35 r'<title>(.*)</title>', webpage, 'title').split('/')[0].strip()
37 video_url = self._search_regex(
38 r'src\s*:\s*(["\'])(?P<url>.+?.mp4.*?)\1',
39 webpage, 'video url', default=None, group='url')
41 thumbnail_url = self._og_search_thumbnail(webpage)
44 info_response = self._download_webpage(
45 'http://vbox7.com/play/magare.do', video_id,
46 'Downloading info webpage',
47 data=urlencode_postdata({'as3': '1', 'vid': video_id}),
48 headers={'Content-Type': 'application/x-www-form-urlencoded'})
49 final_url, thumbnail_url = map(
50 lambda x: x.split('=')[1], info_response.split('&'))
52 if '/na.mp4' in video_url:
53 self.raise_geo_restricted()
57 'url': self._proto_relative_url(video_url, 'http:'),
59 'thumbnail': thumbnail_url,