]>
Commit | Line | Data |
---|---|---|
1fe8fb8c | 1 | from __future__ import unicode_literals |
1fe8fb8c JMF |
2 | |
3 | from .common import InfoExtractor | |
4 | from .ooyala import OoyalaIE | |
5 | from ..utils import ExtractorError | |
6 | ||
7 | ||
8 | class ViceIE(InfoExtractor): | |
18ae46ad | 9 | _VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)' |
1fe8fb8c | 10 | |
7a4a945f | 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', | |
cce9d15d | 18 | 'duration': 725983, |
7a4a945f | 19 | }, |
20 | 'params': { | |
21 | # Requires ffmpeg (m3u8 manifest) | |
22 | 'skip_download': True, | |
23 | }, | |
24 | }, { | |
25 | 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab', | |
65c2b21d | 26 | 'only_matching': True, |
7a4a945f | 27 | } |
28 | ] | |
1fe8fb8c JMF |
29 | |
30 | def _real_extract(self, url): | |
18ae46ad S |
31 | video_id = self._match_id(url) |
32 | webpage = self._download_webpage(url, video_id) | |
1fe8fb8c JMF |
33 | try: |
34 | embed_code = self._search_regex( | |
35 | r'embedCode=([^&\'"]+)', webpage, | |
36 | 'ooyala embed code') | |
37 | ooyala_url = OoyalaIE._url_for_embed_code(embed_code) | |
1fe8fb8c JMF |
38 | except ExtractorError: |
39 | raise ExtractorError('The page doesn\'t contain a video', expected=True) | |
40 | return self.url_result(ooyala_url, ie='Ooyala') |