]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vice.py
Imported Upstream version 2015.11.10
[youtubedl] / youtube_dl / extractor / vice.py
1 from __future__ import unicode_literals
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'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)'
10
11 _TESTS = [
12 {
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 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
25 'only_matching': True,
26 }
27 ]
28
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31 webpage = self._download_webpage(url, video_id)
32 try:
33 embed_code = self._search_regex(
34 r'embedCode=([^&\'"]+)', webpage,
35 'ooyala embed code')
36 ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
37 except ExtractorError:
38 raise ExtractorError('The page doesn\'t contain a video', expected=True)
39 return self.url_result(ooyala_url, ie='Ooyala')