diff options
author | remitamine <remitamine@gmail.com> | 2015-12-29 11:36:04 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-12-29 11:36:04 +0100 |
commit | 422f7c112c12d92bf06c95ff33782c8e9a0df43e (patch) | |
tree | 0c767e85421383f309fd1d27ea3e1fe1aa7f82ec /youtube_dl/extractor/srgssr.py | |
parent | b19ad2fb53c43c573d22663a739d192509bd8097 (diff) |
[srgssr] update tests
Diffstat (limited to 'youtube_dl/extractor/srgssr.py')
-rw-r--r-- | youtube_dl/extractor/srgssr.py | 38 |
1 files changed, 13 insertions, 25 deletions
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): |