1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from .ooyala
import OoyalaIE
7 from ..utils
import ExtractorError
10 class ViceIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)?videos?/(?P<id>[^/?#&]+)'
14 'url': 'http://www.vice.com/video/cowboy-capitalists-part-1',
16 'id': '43cW1mYzpia9IlestBjVpd23Yu3afAfp',
18 'title': 'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
22 # Requires ffmpeg (m3u8 manifest)
23 'skip_download': True,
26 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
27 'only_matching': True,
29 'url': 'http://www.vice.com/ru/video/big-night-out-ibiza-clive-martin-229',
30 'only_matching': True,
32 'url': 'https://munchies.vice.com/en/videos/watch-the-trailer-for-our-new-series-the-pizza-show',
33 'only_matching': True,
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
38 webpage
= self
._download
_webpage
(url
, video_id
)
40 embed_code
= self
._search
_regex
(
41 r
'embedCode=([^&\'"]+)', webpage,
43 ooyala_url = OoyalaIE._url_for_embed_code(embed_code)
44 except ExtractorError:
45 raise ExtractorError('The page doesn\'t contain a video', expected=True)
46 return self.url_result(ooyala_url, ie='Ooyala')
49 class ViceShowIE(InfoExtractor):
50 _VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)?show/(?P<id>[^/?#&]+)'
53 'url': 'https://munchies.vice.com/en/show/fuck-thats-delicious-2',
55 'id': 'fuck-thats-delicious-2',
56 'title': "Fuck
, That
's Delicious",
57 'description
': 'Follow the culinary adventures of rapper Action Bronson during his ongoing world tour
.',
62 def _real_extract(self, url):
63 show_id = self._match_id(url)
64 webpage = self._download_webpage(url, show_id)
67 self.url_result(video_url, ViceIE.ie_key())
68 for video_url, _ in re.findall(
69 r'<h2
[^
>]+class="article-title"[^
>]+data
-id="\d+"[^
>]*>\s
*<a
[^
>]+href
="(%s.*?)"'
70 % ViceIE._VALID_URL, webpage)]
72 title = self._search_regex(
73 r'<title
>(.+?
)</title
>', webpage, 'title
', default=None)
75 title = re.sub(r'(.+)\s
*\|\s
*.+$
', r'\
1', title).strip()
76 description = self._html_search_meta('description
', webpage, 'description
')
78 return self.playlist_result(entries, show_id, title, description)