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