]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/philharmoniedeparis.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..compat 
import compat_str
 
  12 class PhilharmonieDeParisIE(InfoExtractor
): 
  13     IE_DESC 
= 'Philharmonie de Paris' 
  17                             live\.philharmoniedeparis\.fr/(?:[Cc]oncert/|embed(?:app)?/|misc/Playlist\.ashx\?id=)| 
  18                             pad\.philharmoniedeparis\.fr/doc/CIMU/ 
  23         'url': 'http://pad.philharmoniedeparis.fr/doc/CIMU/1086697/jazz-a-la-villette-knower', 
  24         'md5': 'a0a4b195f544645073631cbec166a2c2', 
  28             'title': 'Jazz à la Villette : Knower', 
  31         'url': 'http://live.philharmoniedeparis.fr/concert/1032066.html', 
  34             'title': 'md5:0a031b81807b3593cffa3c9a87a167a0', 
  36         'playlist_mincount': 2, 
  38         'url': 'http://live.philharmoniedeparis.fr/Concert/1030324.html', 
  39         'only_matching': True, 
  41         'url': 'http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=1030324&track=&lang=fr', 
  42         'only_matching': True, 
  44         'url': 'https://live.philharmoniedeparis.fr/embedapp/1098406/berlioz-fantastique-lelio-les-siecles-national-youth-choir-of.html?lang=fr-FR', 
  45         'only_matching': True, 
  47         'url': 'https://live.philharmoniedeparis.fr/embed/1098406/berlioz-fantastique-lelio-les-siecles-national-youth-choir-of.html?lang=fr-FR', 
  48         'only_matching': True, 
  50     _LIVE_URL 
= 'https://live.philharmoniedeparis.fr' 
  52     def _real_extract(self
, url
): 
  53         video_id 
= self
._match
_id
(url
) 
  55         config 
= self
._download
_json
( 
  56             '%s/otoPlayer/config.ashx' % self
._LIVE
_URL
, video_id
, query
={ 
  61         def extract_entry(source
): 
  62             if not isinstance(source
, dict): 
  64             title 
= source
.get('title') 
  67             files 
= source
.get('files') 
  68             if not isinstance(files
, dict): 
  72             for format_id 
in ('mobile', 'desktop'): 
  74                     files
, lambda x
: x
[format_id
]['file'], compat_str
) 
  75                 if not format_url 
or format_url 
in format_urls
: 
  77                 format_urls
.add(format_url
) 
  78                 m3u8_url 
= urljoin(self
._LIVE
_URL
, format_url
) 
  79                 formats
.extend(self
._extract
_m
3u8_formats
( 
  80                     m3u8_url
, video_id
, 'mp4', entry_protocol
='m3u8_native', 
  81                     m3u8_id
='hls', fatal
=False)) 
  84             self
._sort
_formats
(formats
) 
  90         thumbnail 
= urljoin(self
._LIVE
_URL
, config
.get('image')) 
  92         info 
= extract_entry(config
) 
  96                 'thumbnail': thumbnail
, 
 101         for num
, chapter 
in enumerate(config
['chapters'], start
=1): 
 102             entry 
= extract_entry(chapter
) 
 103             entry
['id'] = '%s-%d' % (video_id
, num
) 
 104             entries
.append(entry
) 
 106         return self
.playlist_result(entries
, video_id
, config
.get('title'))