]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/viceland.py
fix compat_urllib_request for python2.7
[youtube-dl] / youtube_dl / extractor / viceland.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .vice import ViceBaseIE
7
8
9 class VicelandIE(ViceBaseIE):
10     _VALID_URL = r'https?://(?:www\.)?viceland\.com/(?P<locale>[^/]+)/video/[^/]+/(?P<id>[a-f0-9]+)'
11     _TEST = {
12         'url': 'https://www.viceland.com/en_us/video/trapped/588a70d0dba8a16007de7316',
13         'info_dict': {
14             'id': '588a70d0dba8a16007de7316',
15             'ext': 'mp4',
16             'title': 'TRAPPED (Series Trailer)',
17             'description': 'md5:7a8e95c2b6cd86461502a2845e581ccf',
18             'age_limit': 14,
19             'timestamp': 1485474122,
20             'upload_date': '20170126',
21             'uploader_id': '57a204098cb727dec794c6a3',
22             'uploader': 'Viceland',
23         },
24         'params': {
25             # m3u8 download
26             'skip_download': True,
27         },
28         'add_ie': ['UplynkPreplay'],
29         'skip': '404',
30     }
31     _PREPLAY_HOST = 'www.viceland'
32
33     def _real_extract(self, url):
34         mobj = re.match(self._VALID_URL, url)
35         video_id = mobj.group('id')
36         locale = mobj.group('locale')
37         webpage = self._download_webpage(url, video_id)
38         return self._extract_preplay_video(url, locale, webpage)