]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vice.py
Update changelog.
[youtubedl] / youtube_dl / extractor / vice.py
1 import re
2
3 from .common import InfoExtractor
4 from .ooyala import OoyalaIE
5 from ..utils import ExtractorError
6
7
8 class ViceIE(InfoExtractor):
9 _VALID_URL = r'http://www\.vice\.com/.*?/(?P<name>.+)'
10
11 _TEST = {
12 u'url': u'http://www.vice.com/Fringes/cowboy-capitalists-part-1',
13 u'file': u'43cW1mYzpia9IlestBjVpd23Yu3afAfp.mp4',
14 u'info_dict': {
15 u'title': u'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
16 },
17 u'params': {
18 # Requires ffmpeg (m3u8 manifest)
19 u'skip_download': True,
20 },
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 name = mobj.group('name')
26 webpage = self._download_webpage(url, name)
27 try:
28 ooyala_url = self._og_search_video_url(webpage)
29 except ExtractorError:
30 try:
31 embed_code = self._search_regex(
32 r'OO.Player.create\(\'ooyalaplayer\', \'(.+?)\'', webpage,
33 u'ooyala embed code')
34 ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
35 except ExtractorError:
36 raise ExtractorError(u'The page doesn\'t contain a video', expected=True)
37 return self.url_result(ooyala_url, ie='Ooyala')
38