[firedrive] Simplify

This commit is contained in:
Philipp Hagemeister 2014-07-12 14:27:14 +02:00
parent 0d90e0f067
commit c993c829e2

View file

@ -24,7 +24,7 @@ class FiredriveIE(InfoExtractor):
'id': 'FEB892FA160EBD01', 'id': 'FEB892FA160EBD01',
'ext': 'flv', 'ext': 'flv',
'title': 'bbb_theora_486kbit.flv', 'title': 'bbb_theora_486kbit.flv',
'thumbnail': 're:http://.*\.jpg', 'thumbnail': 're:^http://.*\.jpg$',
}, },
}] }]
@ -37,7 +37,7 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
if re.search(self._FILE_DELETED_REGEX, webpage) is not None: 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) expected=True)
fields = dict(re.findall(r'''(?x)<input\s+ fields = dict(re.findall(r'''(?x)<input\s+
@ -60,22 +60,24 @@ def _real_extract(self, url):
title = self._search_regex(r'class="external_title_left">(.+)</div>', title = self._search_regex(r'class="external_title_left">(.+)</div>',
webpage, 'title') webpage, 'title')
thumbnail = self._search_regex(r'image:\s?"(//[^\"]+)', webpage, thumbnail = self._search_regex(r'image:\s?"(//[^\"]+)', webpage,
'thumbnail', fatal=False, default="") 'thumbnail', fatal=False)
url = self._search_regex(r'file:\s?\'(http[^\']+)\',', if thumbnail is not None:
webpage, 'file url') thumbnail = 'http:' + thumbnail
ext = self._search_regex(r'type:\s?\'([^\']+)\',', ext = self._search_regex(r'type:\s?\'([^\']+)\',',
webpage, 'extension', fatal=False) webpage, 'extension', fatal=False)
video_url = self._search_regex(
r'file:\s?\'(http[^\']+)\',', webpage, 'file url')
formats = [{ formats = [{
'format_id': 'sd', 'format_id': 'sd',
'url': url, 'url': video_url,
'ext': ext or determine_ext(url), 'ext': ext,
'quality': 1,
}] }]
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'thumbnail': "http:" + thumbnail, 'thumbnail': thumbnail,
'formats': formats, 'formats': formats,
} }