From: Philipp Hagemeister Date: Fri, 7 Feb 2014 11:00:25 +0000 (+0100) Subject: [chilloutzone] Simplify (#2338) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=4a9540b6d23ce247e13d74ce1f16f0aed238e08b;p=youtube-dl [chilloutzone] Simplify (#2338) --- diff --git a/youtube_dl/extractor/chilloutzone.py b/youtube_dl/extractor/chilloutzone.py index 59a188746..39e9d962f 100644 --- a/youtube_dl/extractor/chilloutzone.py +++ b/youtube_dl/extractor/chilloutzone.py @@ -1,14 +1,15 @@ +from __future__ import unicode_literals + import re import base64 -import urllib import json from .common import InfoExtractor +from ..utils import clean_html -video_container = ('.mp4', '.mkv', '.flv') class ChilloutzoneIE(InfoExtractor): - _VALID_URL = r'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+).html' + _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+)\.html' _TEST = { 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', 'md5': 'a76f3457e813ea0037e5244f509e66d1', @@ -16,6 +17,7 @@ class ChilloutzoneIE(InfoExtractor): 'id': 'enemene-meck-alle-katzen-weg', 'ext': 'mp4', 'title': 'Enemene Meck - Alle Katzen weg', + 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?', }, } @@ -23,71 +25,45 @@ class ChilloutzoneIE(InfoExtractor): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - webpage_url = 'http://www.chilloutzone.net/video/' + video_id + '.html' + webpage = self._download_webpage(url, video_id) - # 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 + base64_video_info = self._html_search_regex( + r'var cozVidData = "(.+?)";', webpage, 'video data') decoded_video_info = base64.b64decode(base64_video_info).decode("utf-8") video_info_dict = json.loads(decoded_video_info) + # get video information from dict - media_url = video_info_dict['mediaUrl'] - description = video_info_dict['description'] + 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'] - - # 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'