1 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..utils import clean_html
11 class ChilloutzoneIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+)\.html'
14 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
15 'md5': 'a76f3457e813ea0037e5244f509e66d1',
17 'id': 'enemene-meck-alle-katzen-weg',
19 'title': 'Enemene Meck - Alle Katzen weg',
20 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
28 webpage = self._download_webpage(url, video_id)
30 base64_video_info = self._html_search_regex(
31 r'var cozVidData = "(.+?)";', webpage, 'video data')
32 decoded_video_info = base64.b64decode(base64_video_info).decode("utf-8")
33 video_info_dict = json.loads(decoded_video_info)
35 # get video information from dict
36 video_url = video_info_dict['mediaUrl']
37 description = clean_html(video_info_dict.get('description'))
38 title = video_info_dict['title']
39 native_platform = video_info_dict['nativePlatform']
40 native_video_id = video_info_dict['nativeVideoId']
41 source_priority = video_info_dict['sourcePriority']
43 # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
44 if native_platform is None:
45 youtube_url = self._html_search_regex(
46 r'<iframe.* src="((?:https?:)?//(?:[^.]+\.)?youtube\.com/.+?)"',
47 webpage, 'fallback video URL', default=None)
48 if youtube_url is not None:
49 return self.url_result(youtube_url, ie='Youtube')
51 # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
53 if source_priority == 'native':
54 if native_platform == 'youtube':
55 return self.url_result(video_id, ie='Youtube')
56 if native_platform == 'vimeo':
57 return self.url_result(
58 'http://vimeo.com/' + native_video_id, ie='Vimeo')
61 raise ExtractorError('No video found')
68 'description': description,