]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vice.py
e2b2ce0981cc8767ade2f5ef4c8bc52759b86af3
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..utils
import ExtractorError
9 class ViceIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)?videos?/(?P<id>[^/?#&]+)'
13 'url': 'http://www.vice.com/video/cowboy-capitalists-part-1',
14 'md5': 'e9d77741f9e42ba583e683cd170660f7',
16 'id': '43cW1mYzpia9IlestBjVpd23Yu3afAfp',
18 'title': 'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
23 'url': 'http://www.vice.com/video/how-to-hack-a-car',
24 'md5': '6fb2989a3fed069fb8eab3401fc2d3c9',
28 'title': 'How to Hack a Car: Phreaked Out (Episode 2)',
29 'description': 'md5:ee95453f7ff495db8efe14ae8bf56f30',
30 'uploader_id': 'MotherboardTV',
31 'uploader': 'Motherboard',
32 'upload_date': '20140529',
34 'add_ie': ['Youtube'],
36 'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
37 'only_matching': True,
39 'url': 'http://www.vice.com/ru/video/big-night-out-ibiza-clive-martin-229',
40 'only_matching': True,
42 'url': 'https://munchies.vice.com/en/videos/watch-the-trailer-for-our-new-series-the-pizza-show',
43 'only_matching': True,
46 def _real_extract(self
, url
):
47 video_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, video_id
)
50 embed_code
= self
._search
_regex
(
51 r
'embedCode=([^&\'"]+)', webpage,
52 'ooyala embed code', default=None)
54 return self.url_result('ooyala:%s' % embed_code, 'Ooyala')
55 youtube_id = self._search_regex(
56 r'data-youtube-id="([^
"]+)"', webpage, 'youtube
id')
57 return self.url_result(youtube_id, 'Youtube
')
58 except ExtractorError:
59 raise ExtractorError('The page doesn
\'t contain a video
', expected=True)
62 class ViceShowIE(InfoExtractor):
63 _VALID_URL = r'https?
://(?
:.+?\
.)?vice\
.com
/(?
:[^
/]+/)?show
/(?P
<id>[^
/?
#&]+)'
66 'url': 'https://munchies.vice.com/en/show/fuck-thats-delicious-2',
68 'id': 'fuck-thats-delicious-2',
69 'title': "Fuck, That's Delicious",
70 'description': 'Follow the culinary adventures of rapper Action Bronson during his ongoing world tour.',
75 def _real_extract(self
, url
):
76 show_id
= self
._match
_id
(url
)
77 webpage
= self
._download
_webpage
(url
, show_id
)
80 self
.url_result(video_url
, ViceIE
.ie_key())
81 for video_url
, _
in re
.findall(
82 r
'<h2[^>]+class="article-title"[^>]+data-id="\d+"[^>]*>\s*<a[^>]+href="(%s.*?)"'
83 % ViceIE
._VALID
_URL
, webpage
)]
85 title
= self
._search
_regex
(
86 r
'<title>(.+?)</title>', webpage
, 'title', default
=None)
88 title
= re
.sub(r
'(.+)\s*\|\s*.+$', r
'\1', title
).strip()
89 description
= self
._html
_search
_meta
('description', webpage
, 'description')
91 return self
.playlist_result(entries
, show_id
, title
, description
)