[theplatform] prefer hls streams

This commit is contained in:
remitamine 2015-07-18 08:52:24 +01:00
parent 53b8247cb5
commit c32f94f92d

View File

@ -110,7 +110,7 @@ class ThePlatformIE(InfoExtractor):
config = self._download_json(config_url, video_id, 'Downloading config') config = self._download_json(config_url, video_id, 'Downloading config')
smil_url = config['releaseUrl'] + '&format=SMIL&formats=MPEG4&manifest=f4m' smil_url = config['releaseUrl'] + '&format=SMIL&formats=MPEG4&manifest=f4m'
else: else:
smil_url = 'http://link.theplatform.com/s/%s/meta.smil?format=smil&mbr=true' % path smil_url = 'http://link.theplatform.com/s/%s/meta.smil?format=smil&mbr=true&manifest=m3u' % path
sig = smuggled_data.get('sig') sig = smuggled_data.get('sig')
if sig: if sig:
@ -144,17 +144,20 @@ class ThePlatformIE(InfoExtractor):
head = meta.find(_x('smil:head')) head = meta.find(_x('smil:head'))
body = meta.find(_x('smil:body')) body = meta.find(_x('smil:body'))
f4m_node = body.find(_x('smil:seq//smil:video')) node = body.find(_x('smil:seq//smil:video'))
if f4m_node is None: if node is None:
f4m_node = body.find(_x('smil:seq/smil:video')) node = body.find(_x('smil:seq/smil:video'))
if f4m_node is not None and '.f4m' in f4m_node.attrib['src']: if node is not None:
f4m_url = f4m_node.attrib['src'] if '.m3u8' in node.attrib['src']:
if 'manifest.f4m?' not in f4m_url: formats = self._extract_m3u8_formats(node.attrib['src'], video_id)
f4m_url += '?' if '.f4m' in node.attrib['src']:
# the parameters are from syfy.com, other sites may use others, f4m_url = node.attrib['src']
# they also work for nbc.com if 'manifest.f4m?' not in f4m_url:
f4m_url += '&g=UXWGVKRWHFSP&hdcore=3.0.3' f4m_url += '?'
formats = self._extract_f4m_formats(f4m_url, video_id) # the parameters are from syfy.com, other sites may use others,
# they also work for nbc.com
f4m_url += '&g=UXWGVKRWHFSP&hdcore=3.0.3'
formats = self._extract_f4m_formats(f4m_url, video_id)
else: else:
formats = [] formats = []
switch = body.find(_x('smil:switch')) switch = body.find(_x('smil:switch'))