2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import ExtractorError
10 class Vbox7IE(InfoExtractor):
13 (?:[^/]+\.)?vbox7\.com/
23 _GEO_COUNTRIES = ['BG']
25 'url': 'http://vbox7.com/play:0946fff23c',
26 'md5': 'a60f9ab3a3a2f013ef9a967d5f7be5bf',
30 'title': 'Борисов: Притеснен съм за бъдещето на България',
31 'description': 'По думите му е опасно страната ни да бъде обявена за "сигурна"',
32 'thumbnail': r're:^https?://.*\.jpg$',
33 'timestamp': 1470982814,
34 'upload_date': '20160812',
35 'uploader': 'zdraveibulgaria',
38 'proxy': '127.0.0.1:8118',
41 'url': 'http://vbox7.com/play:249bb972c2',
42 'md5': '99f65c0c9ef9b682b97313e052734c3f',
46 'title': 'Смях! Чудо - чист за секунди - Скрита камера',
48 'skip': 'georestricted',
50 'url': 'http://vbox7.com/emb/external.php?vid=a240d20f9c&autoplay=1',
51 'only_matching': True,
53 'url': 'http://i49.vbox7.com/player/ext.swf?vid=0946fff23c&autoplay=1',
54 'only_matching': True,
58 def _extract_url(webpage):
60 r'<iframe[^>]+src=(?P<q>["\'])(?P<url>(?:https?:)?//vbox7\.com/emb/external\.php.+?)(?P=q)',
63 return mobj.group('url')
65 def _real_extract(self, url):
66 video_id = self._match_id(url)
68 response = self._download_json(
69 'https://www.vbox7.com/ajax/video/nextvideo.php?vid=%s' % video_id,
72 if 'error' in response:
74 '%s said: %s' % (self.IE_NAME, response['error']), expected=True)
76 video = response['options']
78 title = video['title']
79 video_url = video['src']
81 if '/na.mp4' in video_url:
82 self.raise_geo_restricted(countries=self._GEO_COUNTRIES)
84 uploader = video.get('uploader')
86 webpage = self._download_webpage(
87 'http://vbox7.com/play:%s' % video_id, video_id, fatal=None)
92 info = self._search_json_ld(
93 webpage.replace('"/*@context"', '"@context"'), video_id,
100 'uploader': uploader,
101 'thumbnail': self._proto_relative_url(
102 info.get('thumbnail') or self._og_search_thumbnail(webpage),