1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-16 06:34:31 +01:00

[theplatform] always force theplatform to return a smil for _extract_theplatform_smil

This commit is contained in:
remitamine 2016-03-18 09:21:21 +01:00
parent e3d17b3c07
commit 4c92fd2e83
5 changed files with 10 additions and 8 deletions

View File

@ -24,5 +24,5 @@ class BravoTVIE(InfoExtractor):
account_pid = self._search_regex(r'"account_pid"\s*:\s*"([^"]+)"', webpage, 'account pid') account_pid = self._search_regex(r'"account_pid"\s*:\s*"([^"]+)"', webpage, 'account pid')
release_pid = self._search_regex(r'"release_pid"\s*:\s*"([^"]+)"', webpage, 'release pid') release_pid = self._search_regex(r'"release_pid"\s*:\s*"([^"]+)"', webpage, 'release pid')
return self.url_result(smuggle_url( return self.url_result(smuggle_url(
'http://link.theplatform.com/s/%s/%s?format=SMIL&mbr=true&switch=progressive' % (account_pid, release_pid), 'http://link.theplatform.com/s/%s/%s?mbr=true&switch=progressive' % (account_pid, release_pid),
{'force_smil_url': True}), 'ThePlatform', release_pid) {'force_smil_url': True}), 'ThePlatform', release_pid)

View File

@ -78,7 +78,7 @@ class CBSNewsIE(ThePlatformIE):
pid = item.get('media' + format_id) pid = item.get('media' + format_id)
if not pid: if not pid:
continue continue
release_url = 'http://link.theplatform.com/s/dJ5BDC/%s?format=SMIL&mbr=true' % pid release_url = 'http://link.theplatform.com/s/dJ5BDC/%s?mbr=true' % pid
tp_formats, tp_subtitles = self._extract_theplatform_smil(release_url, video_id, 'Downloading %s SMIL data' % pid) tp_formats, tp_subtitles = self._extract_theplatform_smil(release_url, video_id, 'Downloading %s SMIL data' % pid)
formats.extend(tp_formats) formats.extend(tp_formats)
subtitles = self._merge_subtitles(subtitles, tp_subtitles) subtitles = self._merge_subtitles(subtitles, tp_subtitles)

View File

@ -60,7 +60,7 @@ class CNETIE(ThePlatformIE):
for (fkey, vid) in vdata['files'].items(): for (fkey, vid) in vdata['files'].items():
if fkey == 'hls_phone' and 'hls_tablet' in vdata['files']: if fkey == 'hls_phone' and 'hls_tablet' in vdata['files']:
continue continue
release_url = 'http://link.theplatform.com/s/kYEXFC/%s?format=SMIL&mbr=true' % vid release_url = 'http://link.theplatform.com/s/kYEXFC/%s?mbr=true' % vid
if fkey == 'hds': if fkey == 'hds':
release_url += '&manifest=f4m' release_url += '&manifest=f4m'
tp_formats, tp_subtitles = self._extract_theplatform_smil(release_url, video_id, 'Downloading %s SMIL data' % fkey) tp_formats, tp_subtitles = self._extract_theplatform_smil(release_url, video_id, 'Downloading %s SMIL data' % fkey)

View File

@ -48,7 +48,7 @@ class NationalGeographicIE(InfoExtractor):
theplatform_id = url_basename(content.attrib.get('url')) theplatform_id = url_basename(content.attrib.get('url'))
return self.url_result(smuggle_url( return self.url_result(smuggle_url(
'http://link.theplatform.com/s/ngs/%s?format=SMIL&formats=MPEG4&manifest=f4m' % theplatform_id, 'http://link.theplatform.com/s/ngs/%s?formats=MPEG4&manifest=f4m' % theplatform_id,
# For some reason, the normal links don't work and we must force # For some reason, the normal links don't work and we must force
# the use of f4m # the use of f4m
{'force_smil_url': True})) {'force_smil_url': True}))

View File

@ -22,6 +22,7 @@ from ..utils import (
xpath_with_ns, xpath_with_ns,
mimetype2ext, mimetype2ext,
find_xpath_attr, find_xpath_attr,
update_url_query,
) )
default_ns = 'http://www.w3.org/2005/SMIL21/Language' default_ns = 'http://www.w3.org/2005/SMIL21/Language'
@ -30,6 +31,7 @@ _x = lambda p: xpath_with_ns(p, {'smil': default_ns})
class ThePlatformBaseIE(OnceIE): class ThePlatformBaseIE(OnceIE):
def _extract_theplatform_smil(self, smil_url, video_id, note='Downloading SMIL data'): def _extract_theplatform_smil(self, smil_url, video_id, note='Downloading SMIL data'):
smil_url = update_url_query(smil_url, {'format': 'SMIL'})
meta = self._download_xml(smil_url, video_id, note=note) meta = self._download_xml(smil_url, video_id, note=note)
error_element = find_xpath_attr( error_element = find_xpath_attr(
meta, _x('.//smil:ref'), 'src', meta, _x('.//smil:ref'), 'src',
@ -213,7 +215,7 @@ class ThePlatformIE(ThePlatformBaseIE):
webpage, 'smil url', group='url') webpage, 'smil url', group='url')
path = self._search_regex( path = self._search_regex(
r'link\.theplatform\.com/s/((?:[^/?#&]+/)+[^/?#&]+)', smil_url, 'path') r'link\.theplatform\.com/s/((?:[^/?#&]+/)+[^/?#&]+)', smil_url, 'path')
smil_url += '?' if '?' not in smil_url else '&' + 'formats=m3u,mpeg4&format=SMIL' smil_url += '?' if '?' not in smil_url else '&' + 'formats=m3u,mpeg4'
elif mobj.group('config'): elif mobj.group('config'):
config_url = url + '&form=json' config_url = url + '&form=json'
config_url = config_url.replace('swf/', 'config/') config_url = config_url.replace('swf/', 'config/')
@ -223,9 +225,9 @@ class ThePlatformIE(ThePlatformBaseIE):
release_url = config['releaseUrl'] release_url = config['releaseUrl']
else: else:
release_url = 'http://link.theplatform.com/s/%s?mbr=true' % path release_url = 'http://link.theplatform.com/s/%s?mbr=true' % path
smil_url = release_url + '&format=SMIL&formats=MPEG4&manifest=f4m' smil_url = release_url + '&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?mbr=true' % path
sig = smuggled_data.get('sig') sig = smuggled_data.get('sig')
if sig: if sig:
@ -280,7 +282,7 @@ class ThePlatformFeedIE(ThePlatformBaseIE):
first_video_id = None first_video_id = None
duration = None duration = None
for item in entry['media$content']: for item in entry['media$content']:
smil_url = item['plfile$url'] + '&format=SMIL&mbr=true' smil_url = item['plfile$url'] + '&mbr=true'
cur_video_id = ThePlatformIE._match_id(smil_url) cur_video_id = ThePlatformIE._match_id(smil_url)
if first_video_id is None: if first_video_id is None:
first_video_id = cur_video_id first_video_id = cur_video_id