1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-30 19:02:55 +01:00

[gputechconf] improve extraction

This commit is contained in:
remitamine 2015-12-19 23:59:00 +01:00
parent ec6504b39c
commit 1deb710f26

View File

@ -33,18 +33,16 @@ class GPUTechConfIE(InfoExtractor):
doc = self._download_xml('%sxml/%s.xml' % (root_path, xml_file_id), video_id) doc = self._download_xml('%sxml/%s.xml' % (root_path, xml_file_id), video_id)
metadata = xpath_element(doc, 'metadata') metadata = xpath_element(doc, 'metadata')
http_host = xpath_text(metadata, 'httpHost') http_host = xpath_text(metadata, 'httpHost', 'http host', True)
mbr_videos = xpath_element(metadata, 'MBRVideos') mbr_videos = xpath_element(metadata, 'MBRVideos')
formats = [] formats = []
for mbr_video in mbr_videos.findall('MBRVideo'): for mbr_video in mbr_videos.findall('MBRVideo'):
stream_name = xpath_text(mbr_video, 'streamName') stream_name = xpath_text(mbr_video, 'streamName')
if stream_name: if stream_name:
bitrate = int_or_none(xpath_text(mbr_video, 'bitrate'))
formats.append({ formats.append({
'url': 'http://%s/%s' % (http_host, stream_name.replace('mp4:', '')), 'url': 'http://%s/%s' % (http_host, stream_name.replace('mp4:', '')),
'tbr': bitrate, 'tbr': int_or_none(xpath_text(mbr_video, 'bitrate')),
'format_id': 'http-%d' % bitrate,
}) })
self._sort_formats(formats) self._sort_formats(formats)