]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/muenchentv.py
d9f17613633d245283f5f5745acca2feb273cbf5
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  14 class MuenchenTVIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://(?:www\.)?muenchen\.tv/livestream' 
  16     IE_DESC 
= 'münchen.tv' 
  18         'url': 'http://www.muenchen.tv/livestream/', 
  23             'title': 're:^münchen.tv-Livestream [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 
  25             'thumbnail': 're:^https?://.*\.jpg$' 
  28             'skip_download': True, 
  32     def _real_extract(self
, url
): 
  34         webpage 
= self
._download
_webpage
(url
, display_id
) 
  36         title 
= self
._live
_title
(self
._og
_search
_title
(webpage
)) 
  38         data_js 
= self
._search
_regex
( 
  39             r
'(?s)\nplaylist:\s*(\[.*?}\]),', 
  40             webpage
, 'playlist configuration') 
  41         data_json 
= js_to_json(data_js
) 
  42         data 
= json
.loads(data_json
)[0] 
  44         video_id 
= data
['mediaid'] 
  45         thumbnail 
= data
.get('image') 
  48         for format_num
, s 
in enumerate(data
['sources']): 
  49             ext 
= determine_ext(s
['file'], None) 
  50             label_str 
= s
.get('label') 
  52                 label_str 
= '_%d' % format_num
 
  57                 format_id 
= '%s-%s' % (ext
, label_str
) 
  61                 'tbr': int_or_none(s
.get('label')), 
  63                 'format_id': format_id
, 
  64                 'preference': -100 if '.smil' in s
['file'] else 0, 
  66         self
._sort
_formats
(formats
) 
  70             'display_id': display_id
, 
  74             'thumbnail': thumbnail
,