[auengine] Simplify (#4643)

This commit is contained in:
Philipp Hagemeister 2015-01-05 18:21:32 +01:00
parent 18c3c15391
commit 6291438073

View File

@ -7,6 +7,7 @@ from ..compat import compat_urllib_parse
from ..utils import ( from ..utils import (
determine_ext, determine_ext,
ExtractorError, ExtractorError,
remove_end,
) )
@ -27,18 +28,18 @@ class AUEngineIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(?P<title>.+?)</title>', webpage, 'title') title = self._html_search_regex(
title = title.strip() r'<title>\s*(?P<title>.+?)\s*</title>', webpage, 'title')
video_url = re.findall(r'http://\w+.auengine.com/vod/.*[^\W]', webpage) video_urls = re.findall(r'http://\w+.auengine.com/vod/.*[^\W]', webpage)
video_url = map(compat_urllib_parse.unquote, video_url)[0] video_url = compat_urllib_parse.unquote(video_urls[0])
thumbnail = re.findall(r'http://\w+.auengine.com/thumb/.*[^\W]', webpage) thumbnails = re.findall(r'http://\w+.auengine.com/thumb/.*[^\W]', webpage)
thumbnail = map(compat_urllib_parse.unquote, thumbnail)[0] thumbnail = compat_urllib_parse.unquote(thumbnails[0])
if video_url == "" and thumbnail =="": if not video_url:
raise ExtractorError('Could not find video URL') raise ExtractorError('Could not find video URL')
ext = '.' + determine_ext(video_url) ext = '.' + determine_ext(video_url)
if ext == title[-len(ext):]: title = remove_end(title, ext)
title = title[:-len(ext)]
return { return {
'id': video_id, 'id': video_id,
@ -47,4 +48,3 @@ class AUEngineIE(InfoExtractor):
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'http_referer': 'http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf', 'http_referer': 'http://www.auengine.com/flowplayer/flowplayer.commercial-3.2.14.swf',
} }