2015-04-26 12:15:29 +00:00
|
|
|
from .common import InfoExtractor
|
2018-10-01 16:29:24 +00:00
|
|
|
from ..compat import compat_str
|
2022-07-17 10:59:56 +00:00
|
|
|
from ..utils import try_get
|
2015-04-26 12:15:29 +00:00
|
|
|
|
2015-04-26 21:36:32 +00:00
|
|
|
|
2015-04-26 12:15:29 +00:00
|
|
|
class PhilharmonieDeParisIE(InfoExtractor):
|
2015-04-26 21:36:32 +00:00
|
|
|
IE_DESC = 'Philharmonie de Paris'
|
2018-10-01 16:29:24 +00:00
|
|
|
_VALID_URL = r'''(?x)
|
|
|
|
https?://
|
|
|
|
(?:
|
2019-07-06 16:16:38 +00:00
|
|
|
live\.philharmoniedeparis\.fr/(?:[Cc]oncert/|embed(?:app)?/|misc/Playlist\.ashx\?id=)|
|
2022-07-17 10:59:56 +00:00
|
|
|
pad\.philharmoniedeparis\.fr/(?:doc/CIMU/|player\.aspx\?id=)|
|
|
|
|
philharmoniedeparis\.fr/fr/live/concert/|
|
|
|
|
otoplayer\.philharmoniedeparis\.fr/fr/embed/
|
2018-10-01 16:29:24 +00:00
|
|
|
)
|
|
|
|
(?P<id>\d+)
|
|
|
|
'''
|
2015-04-26 12:15:29 +00:00
|
|
|
_TESTS = [{
|
2022-07-17 10:59:56 +00:00
|
|
|
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1129666-danses-symphoniques',
|
|
|
|
'md5': '24bdb7e86c200c107680e1f7770330ae',
|
2018-10-01 16:29:24 +00:00
|
|
|
'info_dict': {
|
2022-07-17 10:59:56 +00:00
|
|
|
'id': '1129666',
|
2018-10-01 16:29:24 +00:00
|
|
|
'ext': 'mp4',
|
2022-07-17 10:59:56 +00:00
|
|
|
'title': 'Danses symphoniques. Orchestre symphonique Divertimento - Zahia Ziouani. Bizet, de Falla, Stravinski, Moussorgski, Saint-Saëns',
|
2018-10-01 16:29:24 +00:00
|
|
|
},
|
|
|
|
}, {
|
2022-07-17 10:59:56 +00:00
|
|
|
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1032066-akademie-fur-alte-musik-berlin-rias-kammerchor-rene-jacobs-passion-selon-saint-jean-de-johann',
|
2015-04-26 12:15:29 +00:00
|
|
|
'info_dict': {
|
|
|
|
'id': '1032066',
|
2022-07-17 10:59:56 +00:00
|
|
|
'title': 'Akademie für alte Musik Berlin, Rias Kammerchor, René Jacobs : Passion selon saint Jean de Johann Sebastian Bach',
|
2015-04-26 21:36:32 +00:00
|
|
|
},
|
2018-10-01 16:29:24 +00:00
|
|
|
'playlist_mincount': 2,
|
2015-04-26 21:36:32 +00:00
|
|
|
}, {
|
2022-07-17 10:59:56 +00:00
|
|
|
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1030324-orchestre-philharmonique-de-radio-france-myung-whun-chung-renaud-capucon-pascal-dusapin-johannes',
|
2015-04-26 21:36:32 +00:00
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
|
|
|
'url': 'http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=1030324&track=&lang=fr',
|
|
|
|
'only_matching': True,
|
2019-07-06 16:16:38 +00:00
|
|
|
}, {
|
|
|
|
'url': 'https://live.philharmoniedeparis.fr/embedapp/1098406/berlioz-fantastique-lelio-les-siecles-national-youth-choir-of.html?lang=fr-FR',
|
|
|
|
'only_matching': True,
|
|
|
|
}, {
|
2022-07-17 10:59:56 +00:00
|
|
|
'url': 'https://otoplayer.philharmoniedeparis.fr/fr/embed/1098406?lang=fr-FR',
|
2019-07-06 16:16:38 +00:00
|
|
|
'only_matching': True,
|
2015-04-26 12:15:29 +00:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
2018-10-01 16:29:24 +00:00
|
|
|
config = self._download_json(
|
2022-07-17 10:59:56 +00:00
|
|
|
'https://otoplayer.philharmoniedeparis.fr/fr/config/%s.json' % video_id, video_id, query={
|
2018-10-01 16:29:24 +00:00
|
|
|
'id': video_id,
|
|
|
|
'lang': 'fr-FR',
|
|
|
|
})
|
2015-04-26 12:15:29 +00:00
|
|
|
|
2018-10-01 16:29:24 +00:00
|
|
|
def extract_entry(source):
|
|
|
|
if not isinstance(source, dict):
|
|
|
|
return
|
|
|
|
title = source.get('title')
|
|
|
|
if not title:
|
|
|
|
return
|
|
|
|
files = source.get('files')
|
|
|
|
if not isinstance(files, dict):
|
|
|
|
return
|
|
|
|
format_urls = set()
|
|
|
|
formats = []
|
|
|
|
for format_id in ('mobile', 'desktop'):
|
|
|
|
format_url = try_get(
|
|
|
|
files, lambda x: x[format_id]['file'], compat_str)
|
|
|
|
if not format_url or format_url in format_urls:
|
2015-04-26 21:36:32 +00:00
|
|
|
continue
|
2018-10-01 16:29:24 +00:00
|
|
|
format_urls.add(format_url)
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
2022-07-17 10:59:56 +00:00
|
|
|
format_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
2018-10-01 16:29:24 +00:00
|
|
|
m3u8_id='hls', fatal=False))
|
2021-05-17 12:23:08 +00:00
|
|
|
if not formats and not self.get_param('ignore_no_formats'):
|
2018-10-01 16:29:24 +00:00
|
|
|
return
|
|
|
|
self._sort_formats(formats)
|
|
|
|
return {
|
|
|
|
'title': title,
|
|
|
|
'formats': formats,
|
2022-07-17 10:59:56 +00:00
|
|
|
'thumbnail': files.get('thumbnail'),
|
2018-10-01 16:29:24 +00:00
|
|
|
}
|
|
|
|
info = extract_entry(config)
|
|
|
|
if info:
|
|
|
|
info.update({
|
|
|
|
'id': video_id,
|
|
|
|
})
|
|
|
|
return info
|
|
|
|
entries = []
|
|
|
|
for num, chapter in enumerate(config['chapters'], start=1):
|
|
|
|
entry = extract_entry(chapter)
|
2022-07-17 10:59:56 +00:00
|
|
|
if entry is None:
|
|
|
|
continue
|
2018-10-01 16:29:24 +00:00
|
|
|
entry['id'] = '%s-%d' % (video_id, num)
|
|
|
|
entries.append(entry)
|
2015-04-26 12:15:29 +00:00
|
|
|
|
2018-10-01 16:29:24 +00:00
|
|
|
return self.playlist_result(entries, video_id, config.get('title'))
|