diff --git a/youtube_dl/extractor/rts.py b/youtube_dl/extractor/rts.py index dc10fd88b..f063ab5dd 100644 --- a/youtube_dl/extractor/rts.py +++ b/youtube_dl/extractor/rts.py @@ -28,7 +28,7 @@ class RTSIE(SRGSSRIE): 'info_dict': { 'id': '3449373', 'display_id': 'les-enfants-terribles', - 'ext': 'flv', + 'ext': 'mp4', 'duration': 1488, 'title': 'Les Enfants Terribles', 'description': 'France Pommier et sa soeur Luce Feral, les deux filles de ce groupe de 5.', @@ -38,6 +38,10 @@ class RTSIE(SRGSSRIE): 'thumbnail': 're:^https?://.*\.image', 'view_count': int, }, + 'params': { + # m3u8 download + 'skip_download': True, + } }, { 'url': 'http://www.rts.ch/emissions/passe-moi-les-jumelles/5624067-entre-ciel-et-mer.html', @@ -45,7 +49,7 @@ class RTSIE(SRGSSRIE): 'info_dict': { 'id': '5742494', 'display_id': '5742494', - 'ext': 'flv', + 'ext': 'mp4', 'duration': 3720, 'title': 'Les yeux dans les cieux - Mon homard au Canada', 'description': 'md5:d22ee46f5cc5bac0912e5a0c6d44a9f7', @@ -55,6 +59,10 @@ class RTSIE(SRGSSRIE): 'thumbnail': 're:^https?://.*\.image', 'view_count': int, }, + 'params': { + # m3u8 download + 'skip_download': True, + } }, { 'url': 'http://www.rts.ch/video/sport/hockey/5745975-1-2-kloten-fribourg-5-2-second-but-pour-gotteron-par-kwiatowski.html', @@ -80,7 +88,7 @@ class RTSIE(SRGSSRIE): 'info_dict': { 'id': '5745356', 'display_id': 'londres-cachee-par-un-epais-smog', - 'ext': 'flv', + 'ext': 'mp4', 'duration': 33, 'title': 'Londres cachée par un épais smog', 'description': 'Un important voile de smog recouvre Londres depuis mercredi, provoqué par la pollution et du sable du Sahara.', @@ -90,6 +98,10 @@ class RTSIE(SRGSSRIE): 'thumbnail': 're:^https?://.*\.image', 'view_count': int, }, + 'params': { + # m3u8 download + 'skip_download': True, + } }, { 'url': 'http://www.rts.ch/audio/couleur3/programmes/la-belle-video-de-stephane-laurenceau/5706148-urban-hippie-de-damien-krisl-03-04-2014.html', @@ -180,16 +192,12 @@ class RTSIE(SRGSSRIE): auth_params = xpath_text(token, './/authparams', 'auth params') if not auth_params: continue - f4m_formats = self._extract_f4m_formats( + formats.extend(self._extract_f4m_formats( '%s?%s&hdcore=3.4.0&plugin=aasp-3.4.0.132.66' % (format_url, auth_params), - media_id, f4m_id=format_id, fatal=False) - if f4m_formats: - formats.extend(f4m_formats) + media_id, f4m_id=format_id, fatal=False)) elif format_url.endswith('.m3u8'): - m3u8_formats = self._extract_m3u8_formats( - format_url, media_id, 'mp4', m3u8_id=format_id, fatal=False) - if m3u8_formats: - formats.extend(m3u8_formats) + formats.extend(self._extract_m3u8_formats( + format_url, media_id, 'mp4', m3u8_id=format_id, fatal=False)) else: formats.append({ 'format_id': format_id, diff --git a/youtube_dl/extractor/srgssr.py b/youtube_dl/extractor/srgssr.py index 563851b3f..4962fe885 100644 --- a/youtube_dl/extractor/srgssr.py +++ b/youtube_dl/extractor/srgssr.py @@ -47,31 +47,24 @@ class SRGSSRIE(InfoExtractor): created_date = media_data.get('createdDate') or metadata.get('createdDate') timestamp = parse_iso8601(created_date) - thumbnails = [] - if 'Image' in media_data: - for image in media_data['Image']['ImageRepresentations']['ImageRepresentation']: - thumbnails.append({ - 'id': image.get('id'), - 'url': image['url'], - }) + thumbnails = [{ + 'id': image.get('id'), + 'url': image['url'], + } for image in media_data.get('Image', {}).get('ImageRepresentations', {}).get('ImageRepresentation', [])] preference = qualities(['LQ', 'MQ', 'SD', 'HQ', 'HD']) formats = [] - for source in media_data['Playlists']['Playlist']: - assets = {} + for source in media_data.get('Playlists', {}).get('Playlist', []) + media_data.get('Downloads', {}).get('Download', []): protocol = source.get('@protocol') if protocol in ('HTTP-HDS', 'HTTP-HLS'): + assets = {} for quality in source['url']: assets[quality['@quality']] = quality['text'] asset_url = assets.get('HD') or assets.get('HQ') or assets.get('SD') or assets.get('MQ') or assets.get('LQ') if '.f4m' in asset_url: - f4m_formats = formats.extend(self._extract_f4m_formats(asset_url + '?hdcore=3.4.0', media_id, f4m_id='hds', fatal=False)) - if f4m_formats: - formats.extend(f4m_formats) + formats.extend(self._extract_f4m_formats(asset_url + '?hdcore=3.4.0', media_id, f4m_id='hds', fatal=False)) elif '.m3u8' in asset_url: - m3u8_formats = formats.extend(self._extract_m3u8_formats(asset_url, media_id, m3u8_id='hls', fatal=False)) - if m3u8_formats: - formats.extend(m3u8_formats) + formats.extend(self._extract_m3u8_formats(asset_url, media_id, m3u8_id='hls', fatal=False)) else: for asset in source['url']: asset_url = asset['text'] @@ -84,15 +77,6 @@ class SRGSSRIE(InfoExtractor): 'preference': preference(asset['@quality']), 'ext': ext, }) - - if 'Downloads' in media_data: - for source in media_data['Downloads']['Download']: - for asset in source['url']: - formats.append({ - 'format_id': asset['@quality'], - 'url': asset['text'], - 'preference': preference(asset['@quality']) - }) self._sort_formats(formats) return { @@ -149,7 +133,7 @@ class SRGSSRPlayIE(InfoExtractor): 'info_dict': { 'id': '6348260', 'display_id': '6348260', - 'ext': 'flv', + 'ext': 'mp4', 'duration': 1796, 'title': 'Le 19h30', 'description': '', @@ -159,6 +143,10 @@ class SRGSSRPlayIE(InfoExtractor): 'thumbnail': 're:^https?://.*\.image', 'view_count': int, }, + 'params': { + # m3u8 download + 'skip_download': True, + } }] def _real_extract(self, url):