]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vbox7.py
a1e0851b7424e4c73cd34b72c02f16bc1905b6ce
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import urlencode_postdata
10 class Vbox7IE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?vbox7\.com/(?:play:|emb/external\.php\?.*?\bvid=)(?P<id>[\da-fA-F]+)'
13 'url': 'http://vbox7.com/play:0946fff23c',
14 'md5': 'a60f9ab3a3a2f013ef9a967d5f7be5bf',
18 'title': 'Борисов: Притеснен съм за бъдещето на България',
21 'url': 'http://vbox7.com/play:249bb972c2',
22 'md5': '99f65c0c9ef9b682b97313e052734c3f',
26 'title': 'Смях! Чудо - чист за секунди - Скрита камера',
28 'skip': 'georestricted',
30 'url': 'http://vbox7.com/emb/external.php?vid=a240d20f9c&autoplay=1',
31 'only_matching': True,
35 def _extract_url(webpage
):
37 '<iframe[^>]+src=(?P<q>["\'])(?P<url>(?:https?:)?//vbox7\.com/emb/external\.php.+?)(?P=q)',
40 return mobj
.group('url')
42 def _real_extract(self
, url
):
43 video_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(
46 'http://vbox7.com/play:%s' % video_id
, video_id
)
48 title
= self
._html
_search
_regex
(
49 r
'<title>(.+?)</title>', webpage
, 'title').split('/')[0].strip()
51 video_url
= self
._search
_regex
(
52 r
'src\s*:\s*(["\'])(?P
<url
>.+?
.mp4
.*?
)\
1',
53 webpage, 'video url
', default=None, group='url
')
55 thumbnail_url = self._og_search_thumbnail(webpage)
58 info_response = self._download_webpage(
59 'http
://vbox7
.com
/play
/magare
.do
', video_id,
60 'Downloading info webpage
',
61 data=urlencode_postdata({'as3
': '1', 'vid
': video_id}),
62 headers={'Content
-Type
': 'application
/x
-www
-form
-urlencoded
'})
63 final_url, thumbnail_url = map(
64 lambda x: x.split('=')[1], info_response.split('&'))
66 if '/na
.mp4
' in video_url:
67 self.raise_geo_restricted()
71 'url
': self._proto_relative_url(video_url, 'http
:'),
73 'thumbnail
': thumbnail_url,