[gputechconf] improve extraction
authorremitamine <remitamine@gmail.com>
Sat, 19 Dec 2015 22:59:00 +0000 (23:59 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 19 Dec 2015 22:59:00 +0000 (23:59 +0100)
youtube_dl/extractor/gputechconf.py

index becc61f1e3aec9ce2268010b5b20dd811a9983d6..145b55bf3e019277d1e8ef958aacb90015cad737 100644 (file)
@@ -33,18 +33,16 @@ class GPUTechConfIE(InfoExtractor):
         doc = self._download_xml('%sxml/%s.xml' % (root_path, xml_file_id), video_id)
 
         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')
 
         formats = []
         for mbr_video in mbr_videos.findall('MBRVideo'):
             stream_name = xpath_text(mbr_video, 'streamName')
             if stream_name:
-                bitrate = int_or_none(xpath_text(mbr_video, 'bitrate'))
                 formats.append({
                     'url': 'http://%s/%s' % (http_host, stream_name.replace('mp4:', '')),
-                    'tbr': bitrate,
-                    'format_id': 'http-%d' % bitrate,
+                    'tbr': int_or_none(xpath_text(mbr_video, 'bitrate')),
                 })
         self._sort_formats(formats)