mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-23 08:54:33 +01:00
[nfb] Add workaround for python2.6
This commit is contained in:
parent
b19fe521a9
commit
c6fdba23a6
@ -49,20 +49,37 @@ class NFBIE(InfoExtractor):
|
|||||||
|
|
||||||
config = self._download_xml(request, video_id, 'Downloading player config XML')
|
config = self._download_xml(request, video_id, 'Downloading player config XML')
|
||||||
|
|
||||||
thumbnail = config.find("./player/stream/media[@type='posterImage']/assets/asset[@quality='high']/default/url").text
|
title = None
|
||||||
video = config.find("./player/stream/media[@type='video']")
|
description = None
|
||||||
duration = int(video.get('duration'))
|
thumbnail = None
|
||||||
title = video.find('title').text
|
duration = None
|
||||||
description = video.find('description').text
|
formats = []
|
||||||
|
|
||||||
# It seems assets always go from lower to better quality, so no need to sort
|
def extract_thumbnail(media):
|
||||||
formats = [{
|
thumbnails = {}
|
||||||
'url': x.find('default/streamerURI').text + '/',
|
for asset in media.findall('assets/asset'):
|
||||||
'play_path': x.find('default/url').text,
|
thumbnails[asset.get('quality')] = asset.find('default/url').text
|
||||||
'rtmp_live': False,
|
if not thumbnails:
|
||||||
'ext': 'mp4',
|
return None
|
||||||
'format_id': x.get('quality'),
|
if 'high' in thumbnails:
|
||||||
} for x in video.findall('assets/asset')]
|
return thumbnails['high']
|
||||||
|
return list(thumbnails.values())[0]
|
||||||
|
|
||||||
|
for media in config.findall('./player/stream/media'):
|
||||||
|
if media.get('type') == 'posterImage':
|
||||||
|
thumbnail = extract_thumbnail(media)
|
||||||
|
elif media.get('type') == 'video':
|
||||||
|
duration = int(media.get('duration'))
|
||||||
|
title = media.find('title').text
|
||||||
|
description = media.find('description').text
|
||||||
|
# It seems assets always go from lower to better quality, so no need to sort
|
||||||
|
formats = [{
|
||||||
|
'url': x.find('default/streamerURI').text + '/',
|
||||||
|
'play_path': x.find('default/url').text,
|
||||||
|
'rtmp_live': False,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': x.get('quality'),
|
||||||
|
} for x in media.findall('assets/asset')]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user