1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-21 23:52:52 +08:00

Merge branch 'chilloutzone'

This commit is contained in:
Andreas Schmitz 2014-02-06 21:33:16 +01:00
commit c0c4e66b29

View File

@ -9,16 +9,14 @@ video_container = ('.mp4', '.mkv', '.flv')
class ChilloutzoneIE(InfoExtractor): class ChilloutzoneIE(InfoExtractor):
_VALID_URL = r'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+).html' _VALID_URL = r'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+).html'
_TEST = { _TEST = {
u'url': u'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
u'file': u'18088-enemene-meck-alle-katzen-weg.mp4', 'md5': 'a76f3457e813ea0037e5244f509e66d1',
u'md5': u'a76f3457e813ea0037e5244f509e66d1', 'info_dict': {
u'info_dict': { 'id': 'enemene-meck-alle-katzen-weg',
u"id": u"18088", 'ext': 'mp4',
u"ext": u"mp4", 'title': 'Enemene Meck - Alle Katzen weg',
u"title": u"Enemene Meck - Alle Katzen weg" },
}
} }
def _real_extract(self, url): def _real_extract(self, url):
@ -31,14 +29,12 @@ class ChilloutzoneIE(InfoExtractor):
self.report_download_webpage(webpage_url) self.report_download_webpage(webpage_url)
webpage = self._download_webpage(webpage_url, video_id) webpage = self._download_webpage(webpage_url, video_id)
# Log that we are starting to parse the page # Log that we are starting to parse the page
self.report_extraction(video_id) self.report_extraction(video_id)
# Find base64 decoded file info # Find base64 decoded file info
base64_video_info = self._html_search_regex(r'var cozVidData = "(.+?)";', webpage, u'video Data') base64_video_info = self._html_search_regex(r'var cozVidData = "(.+?)";', webpage, u'video Data')
# decode string and find video file # decode string and find video file
decoded_video_info = base64.b64decode(base64_video_info) decoded_video_info = base64.b64decode(base64_video_info).decode("utf-8")
video_info_dict = json.loads(decoded_video_info) video_info_dict = json.loads(decoded_video_info)
# get video information from dict # get video information from dict
media_url = video_info_dict['mediaUrl'] media_url = video_info_dict['mediaUrl']
@ -57,7 +53,6 @@ class ChilloutzoneIE(InfoExtractor):
video_url = self._html_search_regex(r'<iframe.* src="(.+?)".*', webpage, u'fallback Video URL') video_url = self._html_search_regex(r'<iframe.* src="(.+?)".*', webpage, u'fallback Video URL')
if 'youtube' in video_url: if 'youtube' in video_url:
self.to_screen(u'Youtube video detected:') self.to_screen(u'Youtube video detected:')
print video_url
return self.url_result(video_url, ie='Youtube') return self.url_result(video_url, ie='Youtube')
# For debugging purposes # For debugging purposes
@ -73,12 +68,10 @@ class ChilloutzoneIE(InfoExtractor):
if native_platform == 'youtube': if native_platform == 'youtube':
self.to_screen(u'Youtube video detected:') self.to_screen(u'Youtube video detected:')
video_url = 'https://www.youtube.com/watch?v=' + native_video_id video_url = 'https://www.youtube.com/watch?v=' + native_video_id
print video_url
return self.url_result(video_url, ie='Youtube') return self.url_result(video_url, ie='Youtube')
if native_platform == 'vimeo': if native_platform == 'vimeo':
self.to_screen(u'Vimeo video detected:') self.to_screen(u'Vimeo video detected:')
video_url = 'http://vimeo.com/' + native_video_id video_url = 'http://vimeo.com/' + native_video_id
print video_url
return self.url_result(video_url, ie='Vimeo') return self.url_result(video_url, ie='Vimeo')
# No redirect, use coz media url # No redirect, use coz media url
@ -93,7 +86,7 @@ class ChilloutzoneIE(InfoExtractor):
'url': video_url, 'url': video_url,
'ext': 'mp4', 'ext': 'mp4',
'title': title, 'title': title,
'description': description 'description': description,
}] }]