X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fchilloutzone.py;h=5aac212991f1625cde463936a94399e0b37ad8a9;hb=HEAD;hp=31618e4c90064f39026d48bd2c69daaee75e9c90;hpb=f2dffe55f8424b673905645cbd9cd132c0a0920a;p=youtube-dl diff --git a/youtube_dl/extractor/chilloutzone.py b/youtube_dl/extractor/chilloutzone.py index 31618e4c9..5aac21299 100644 --- a/youtube_dl/extractor/chilloutzone.py +++ b/youtube_dl/extractor/chilloutzone.py @@ -1,100 +1,96 @@ +from __future__ import unicode_literals + import re -import base64 -import urllib import json from .common import InfoExtractor +from .youtube import YoutubeIE +from ..compat import compat_b64decode +from ..utils import ( + clean_html, + ExtractorError +) -video_container = ('.mp4', '.mkv', '.flv') class ChilloutzoneIE(InfoExtractor): - _VALID_URL = r'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+).html' - - _TEST = { - u'url': u'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', - u'file': u'18088-enemene-meck-alle-katzen-weg.mp4', - u'md5': u'a76f3457e813ea0037e5244f509e66d1', - u'info_dict': { - u"id": u"18088", - u"ext": u"mp4", - u"title": u"Enemene Meck - Alle Katzen weg" - } - } + _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+)\.html' + _TESTS = [{ + 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', + 'md5': 'a76f3457e813ea0037e5244f509e66d1', + 'info_dict': { + 'id': 'enemene-meck-alle-katzen-weg', + 'ext': 'mp4', + 'title': 'Enemene Meck - Alle Katzen weg', + 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?', + }, + }, { + 'note': 'Video hosted at YouTube', + 'url': 'http://www.chilloutzone.net/video/eine-sekunde-bevor.html', + 'info_dict': { + 'id': '1YVQaAgHyRU', + 'ext': 'mp4', + 'title': '16 Photos Taken 1 Second Before Disaster', + 'description': 'md5:58a8fcf6a459fe0a08f54140f0ad1814', + 'uploader': 'BuzzFeedVideo', + 'uploader_id': 'BuzzFeedVideo', + 'upload_date': '20131105', + }, + }, { + 'note': 'Video hosted at Vimeo', + 'url': 'http://www.chilloutzone.net/video/icon-blending.html', + 'md5': '2645c678b8dc4fefcc0e1b60db18dac1', + 'info_dict': { + 'id': '85523671', + 'ext': 'mp4', + 'title': 'The Sunday Times - Icons', + 'description': 're:(?s)^Watch the making of - makingoficons.com.{300,}', + 'uploader': 'Us', + 'uploader_id': 'usfilms', + 'upload_date': '20140131' + }, + }] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - 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'