From c993c829e22cec2e1424ff45deedeecc9638bd5e Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sat, 12 Jul 2014 14:27:14 +0200 Subject: [PATCH] [firedrive] Simplify --- youtube_dl/extractor/firedrive.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/firedrive.py b/youtube_dl/extractor/firedrive.py index 1d83048e8..d26145db1 100644 --- a/youtube_dl/extractor/firedrive.py +++ b/youtube_dl/extractor/firedrive.py @@ -24,7 +24,7 @@ class FiredriveIE(InfoExtractor): 'id': 'FEB892FA160EBD01', 'ext': 'flv', 'title': 'bbb_theora_486kbit.flv', - 'thumbnail': 're:http://.*\.jpg', + 'thumbnail': 're:^http://.*\.jpg$', }, }] @@ -37,7 +37,7 @@ class FiredriveIE(InfoExtractor): webpage = self._download_webpage(url, video_id) if re.search(self._FILE_DELETED_REGEX, webpage) is not None: - raise ExtractorError(u'Video %s does not exist' % video_id, + raise ExtractorError('Video %s does not exist' % video_id, expected=True) fields = dict(re.findall(r'''(?x)(.+)', webpage, 'title') thumbnail = self._search_regex(r'image:\s?"(//[^\"]+)', webpage, - 'thumbnail', fatal=False, default="") - url = self._search_regex(r'file:\s?\'(http[^\']+)\',', - webpage, 'file url') + 'thumbnail', fatal=False) + if thumbnail is not None: + thumbnail = 'http:' + thumbnail + ext = self._search_regex(r'type:\s?\'([^\']+)\',', webpage, 'extension', fatal=False) + video_url = self._search_regex( + r'file:\s?\'(http[^\']+)\',', webpage, 'file url') formats = [{ 'format_id': 'sd', - 'url': url, - 'ext': ext or determine_ext(url), - 'quality': 1, + 'url': video_url, + 'ext': ext, }] return { 'id': video_id, 'title': title, - 'thumbnail': "http:" + thumbnail, + 'thumbnail': thumbnail, 'formats': formats, }