From 2af0f87c8b56567e0254aae7a1ccbedb04413b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Wed, 15 Jul 2015 23:32:52 +0600 Subject: [PATCH] [prosiebensat1] Fix extraction (Closes #6215) --- youtube_dl/extractor/prosiebensat1.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/prosiebensat1.py b/youtube_dl/extractor/prosiebensat1.py index 536a42dc8..22efa903f 100644 --- a/youtube_dl/extractor/prosiebensat1.py +++ b/youtube_dl/extractor/prosiebensat1.py @@ -9,8 +9,9 @@ compat_urllib_parse, ) from ..utils import ( - unified_strdate, + fix_xml_ampersands, int_or_none, + unified_strdate, ) @@ -208,7 +209,7 @@ def _extract_clip(self, url, webpage): clip_id = self._html_search_regex(self._CLIPID_REGEXES, webpage, 'clip id') access_token = 'prosieben' - client_name = 'kolibri-1.12.6' + client_name = 'kolibri-2.0.19-splec4' client_location = url videos_api_url = 'http://vas.sim-technik.de/vas/live/v2/videos?%s' % compat_urllib_parse.urlencode({ @@ -275,8 +276,9 @@ def fix_bitrate(bitrate): for source in urls_sources: protocol = source['protocol'] + source_url = source['url'] if protocol == 'rtmp' or protocol == 'rtmpe': - mobj = re.search(r'^(?Prtmpe?://[^/]+)/(?P.+)$', source['url']) + mobj = re.search(r'^(?Prtmpe?://[^/]+)/(?P.+)$', source_url) if not mobj: continue path = mobj.group('path') @@ -293,9 +295,18 @@ def fix_bitrate(bitrate): 'ext': 'mp4', 'format_id': '%s_%s' % (source['cdn'], source['bitrate']), }) + elif 'f4mgenerator' in source_url: + manifest = self._download_xml( + source_url, clip_id, 'Downloading generated f4m manifest', + transform_source=lambda s: fix_xml_ampersands(s).strip()) + for media in manifest.findall('./{http://ns.adobe.com/f4m/2.0}media'): + manifest_url = media.get('href') + if manifest_url: + formats.extend(self._extract_f4m_formats( + manifest_url, clip_id, f4m_id='hds')) else: formats.append({ - 'url': source['url'], + 'url': source_url, 'vbr': fix_bitrate(source['bitrate']), })