X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ffiredrive.py;h=3191116d96a0df0e61081fbc85e5745c815f1f99;hb=8f02ad4f12549865a2a4436328075f4b20b906ef;hp=1d83048e81d66c59f1a2cb375aa3f97bd809b753;hpb=678f58de4bf8c07116e4ea2255770ab0ba665c14;p=youtube-dl diff --git a/youtube_dl/extractor/firedrive.py b/youtube_dl/extractor/firedrive.py index 1d83048e8..3191116d9 100644 --- a/youtube_dl/extractor/firedrive.py +++ b/youtube_dl/extractor/firedrive.py @@ -4,11 +4,12 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import ( - ExtractorError, +from ..compat import ( compat_urllib_parse, compat_urllib_request, - determine_ext, +) +from ..utils import ( + ExtractorError, ) @@ -24,26 +25,22 @@ class FiredriveIE(InfoExtractor): 'id': 'FEB892FA160EBD01', 'ext': 'flv', 'title': 'bbb_theora_486kbit.flv', - 'thumbnail': 're:http://.*\.jpg', + 'thumbnail': 're:^http://.*\.jpg$', }, }] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') - + video_id = self._match_id(url) url = 'http://firedrive.com/file/%s' % video_id - 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?loadURL\(\'(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, }