-
- idoc = self._download_xml(
- segment_url, segment_title,
- 'Downloading segment information', 'Unable to download segment information')
-
- segment_duration = float_or_none(
- xpath_text(idoc, './/trt', 'segment duration').strip())
-
- formats = []
- file_els = idoc.findall('.//files/file') or idoc.findall('./files/file')
-
- unique_urls = []
- unique_file_els = []
- for file_el in file_els:
- media_url = file_el.text
- if not media_url or determine_ext(media_url) == 'f4m':
- continue
- if file_el.text not in unique_urls:
- unique_urls.append(file_el.text)
- unique_file_els.append(file_el)
-
- for file_el in unique_file_els:
- bitrate = file_el.attrib.get('bitrate')
- ftype = file_el.attrib.get('type')
- media_url = file_el.text
- if determine_ext(media_url) == 'm3u8':
- formats.extend(self._extract_m3u8_formats(
- media_url, segment_title, 'mp4', preference=0, m3u8_id='hls'))
- else:
- formats.append({
- 'format_id': '%s_%s' % (bitrate, ftype),
- 'url': file_el.text.strip(),
- # The bitrate may not be a number (for example: 'iphone')
- 'tbr': int(bitrate) if bitrate.isdigit() else None,
- })
-
- self._sort_formats(formats)
-
- entries.append({