1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-26 17:32:51 +08:00
This commit is contained in:
Leo Lam 2016-04-17 18:13:56 -04:00
parent 4fdf082375
commit 6a72c82d95

View File

@ -107,36 +107,33 @@ class RaiTVIE(InfoExtractor):
return xml.replace(' tag elementi', '').replace('>/', '</') return xml.replace(' tag elementi', '').replace('>/', '</')
relinker = self._download_xml( relinker = self._download_xml(
media['mediaUri'] + '&output=43', media['mediaUri'] + '&output=44',
video_id, transform_source=fix_xml) video_id, transform_source=fix_xml)
has_subtitle = False has_subtitle = False
media_url = relinker.findtext('url')
for element in relinker.findall('element'): ext = determine_ext(media_url)
media_url = xpath_text(element, 'url') content_type = relinker.findtext('ct')
ext = determine_ext(media_url) if ext == 'm3u8':
content_type = xpath_text(element, 'content-type') formats.extend(self._extract_m3u8_formats(
if ext == 'm3u8': media_url, video_id, 'mp4', 'm3u8_native',
formats.extend(self._extract_m3u8_formats( m3u8_id='hls', fatal=False))
media_url, video_id, 'mp4', 'm3u8_native', elif ext == 'f4m':
m3u8_id='hls', fatal=False)) formats.extend(self._extract_f4m_formats(
elif ext == 'f4m': media_url + '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44',
formats.extend(self._extract_f4m_formats( video_id, f4m_id='hds', fatal=False))
media_url + '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44', elif ext == 'stl':
video_id, f4m_id='hds', fatal=False)) has_subtitle = True
elif ext == 'stl': elif content_type.startswith('video/'):
has_subtitle = True bitrate = int_or_none(relinker.findtext('bitrate'))
elif content_type.startswith('video/'): formats.append({
bitrate = int_or_none(xpath_text(element, 'bitrate')) 'url': media_url,
formats.append({ 'tbr': bitrate if bitrate > 0 else None,
'url': media_url, 'format_id': 'http-%d' % bitrate if bitrate > 0 else 'http',
'tbr': bitrate if bitrate > 0 else None, })
'format_id': 'http-%d' % bitrate if bitrate > 0 else 'http', elif content_type.startswith('image/'):
}) thumbnails.append({
elif content_type.startswith('image/'): 'url': media_url,
thumbnails.append({ })
'url': media_url,
})
self._sort_formats(formats) self._sort_formats(formats)