2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class PhilharmonieDeParisIE(InfoExtractor):
14 IE_DESC = 'Philharmonie de Paris'
15 _VALID_URL = r'https?://live\.philharmoniedeparis\.fr/(?:[Cc]oncert/|misc/Playlist\.ashx\?id=)(?P<id>\d+)'
17 'url': 'http://live.philharmoniedeparis.fr/concert/1032066.html',
21 'title': 'md5:d1f5585d87d041d07ce9434804bc8425',
22 'timestamp': 1428179400,
23 'upload_date': '20150404',
28 'skip_download': True,
31 'url': 'http://live.philharmoniedeparis.fr/Concert/1030324.html',
32 'only_matching': True,
34 'url': 'http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=1030324&track=&lang=fr',
35 'only_matching': True,
38 def _real_extract(self, url):
39 video_id = self._match_id(url)
41 concert = self._download_xml(
42 'http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=%s' % video_id,
43 video_id).find('./concert')
48 'title': xpath_text(concert, './titre', 'title', fatal=True),
52 fichiers = concert.find('./fichiers')
53 stream = fichiers.attrib['serveurstream']
54 for fichier in fichiers.findall('./fichier'):
55 info_dict['duration'] = float_or_none(fichier.get('timecodefin'))
56 for quality, (format_id, suffix) in enumerate([('lq', ''), ('hq', '_hd')]):
57 format_url = fichier.get('url%s' % suffix)
62 'play_path': format_url,
64 'format_id': format_id,
65 'width': int_or_none(concert.get('largeur%s' % suffix)),
66 'height': int_or_none(concert.get('hauteur%s' % suffix)),
69 self._sort_formats(formats)
71 date, hour = concert.get('date'), concert.get('heure')
73 info_dict['timestamp'] = parse_iso8601(
74 '%s-%s-%sT%s:00' % (date[0:4], date[4:6], date[6:8], hour))
76 info_dict['upload_date'] = date