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