- video_id = mobj.group('id')
-
- webpage_url = 'http://www.chilloutzone.net/video/' + video_id + '.html'
-
- # Log that we are starting to download the page
- self.report_download_webpage(webpage_url)
- webpage = self._download_webpage(webpage_url, video_id)
-
-
-
- # Log that we are starting to parse the page
- self.report_extraction(video_id)
- # Find base64 decoded file info
- base64_video_info = self._html_search_regex(r'var cozVidData = "(.+?)";', webpage, u'video Data')
- # decode string and find video file
- decoded_video_info = base64.b64decode(base64_video_info)
- video_info_dict = json.loads(decoded_video_info)
- # get video information from dict
- media_url = video_info_dict['mediaUrl']
- description = video_info_dict['description']
- title = video_info_dict['title']
- native_platform = video_info_dict['nativePlatform']
- native_video_id = video_info_dict['nativeVideoId']
- source_priority = video_info_dict['sourcePriority']
-
-
- # Start video extraction
- video_url = ''
- # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
- if native_platform == None:
- # Look for other video urls
- video_url = self._html_search_regex(r'<iframe.* src="(.+?)".*', webpage, u'fallback Video URL')
- if 'youtube' in video_url:
- self.to_screen(u'Youtube video detected:')
- print video_url
- return self.url_result(video_url, ie='Youtube')
-
- # For debugging purposes
- #print video_info_dict
- #print native_platform
- #print native_video_id
- #print source_priority
- #print media_url
-
- # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
- # the own CDN
- if source_priority == 'native':
- if native_platform == 'youtube':
- self.to_screen(u'Youtube video detected:')
- video_url = 'https://www.youtube.com/watch?v=' + native_video_id
- print video_url
- return self.url_result(video_url, ie='Youtube')
+ video_id = mobj.group('id')
+
+ webpage = self._download_webpage(url, video_id)
+
+ base64_video_info = self._html_search_regex(
+ r'var cozVidData = "(.+?)";', webpage, 'video data')
+ decoded_video_info = compat_b64decode(base64_video_info).decode('utf-8')
+ video_info_dict = json.loads(decoded_video_info)
+
+ # get video information from dict
+ video_url = video_info_dict['mediaUrl']
+ description = clean_html(video_info_dict.get('description'))
+ title = video_info_dict['title']
+ native_platform = video_info_dict['nativePlatform']
+ native_video_id = video_info_dict['nativeVideoId']
+ source_priority = video_info_dict['sourcePriority']
+
+ # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
+ if native_platform is None:
+ youtube_url = YoutubeIE._extract_url(webpage)
+ if youtube_url:
+ return self.url_result(youtube_url, ie=YoutubeIE.ie_key())
+
+ # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
+ # the own CDN
+ if source_priority == 'native':
+ if native_platform == 'youtube':
+ return self.url_result(native_video_id, ie='Youtube')