1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[bliptv] Simplify (From #2000)

This commit is contained in:
Philipp Hagemeister 2013-12-23 04:31:38 +01:00
parent 196938835a
commit 466617f539

View file

@ -70,13 +70,14 @@ class BlipTVIE(InfoExtractor):
info = None
urlh = self._request_webpage(request, None, False,
u'unable to download video info webpage')
if urlh.headers.get('Content-Type', '').startswith('video/'): # Direct download
basename = url.split('/')[-1]
title,ext = os.path.splitext(basename)
title = title.decode('UTF-8')
ext = ext.replace('.', '')
self.report_direct_download(title)
info = {
return {
'id': title,
'url': url,
'uploader': None,
@ -85,7 +86,7 @@ class BlipTVIE(InfoExtractor):
'ext': ext,
'urlhandle': urlh
}
if info is None: # Regular URL
try:
json_code_bytes = urlh.read()
json_code = json_code_bytes.decode('utf-8')
@ -111,7 +112,7 @@ class BlipTVIE(InfoExtractor):
raise ValueError('Can not determine filename extension')
ext = umobj.group(1)
info = {
return {
'id': compat_str(data['item_id']),
'url': video_url,
'uploader': data['display_name'],
@ -124,11 +125,9 @@ class BlipTVIE(InfoExtractor):
'player_url': data['embedUrl'],
'user_agent': 'iTunes/10.6.1',
}
except (ValueError,KeyError) as err:
except (ValueError, KeyError) as err:
raise ExtractorError(u'Unable to parse video information: %s' % repr(err))
return [info]
class BlipTVUserIE(InfoExtractor):
"""Information Extractor for blip.tv users."""