]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/massengeschmacktv.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  16 class MassengeschmackTVIE(InfoExtractor
): 
  17     IE_NAME 
= 'massengeschmack.tv' 
  18     _VALID_URL 
= r
'https?://(?:www\.)?massengeschmack\.tv/play/(?P<id>[^?&#]+)' 
  21         'url': 'https://massengeschmack.tv/play/fktv202', 
  22         'md5': 'a9e054db9c2b5a08f0a0527cc201e8d3', 
  26             'title': 'Fernsehkritik-TV - Folge 202', 
  30     def _real_extract(self
, url
): 
  31         episode 
= self
._match
_id
(url
) 
  33         webpage 
= self
._download
_webpage
(url
, episode
) 
  34         title 
= clean_html(self
._html
_search
_regex
( 
  35             '<h3>([^<]+)</h3>', webpage
, 'title')) 
  36         thumbnail 
= self
._search
_regex
(r
'POSTER\s*=\s*"([^"]+)', webpage
, 'thumbnail', fatal
=False) 
  37         sources 
= self
._parse
_json
(self
._search
_regex
(r
'(?s)MEDIA\s*=\s*(\[.+?\]);', webpage
, 'media'), episode
, js_to_json
) 
  40         for source 
in sources
: 
  41             furl 
= source
.get('src') 
  44             furl 
= self
._proto
_relative
_url
(furl
) 
  45             ext 
= determine_ext(furl
) or mimetype2ext(source
.get('type')) 
  47                 formats
.extend(self
._extract
_m
3u8_formats
( 
  48                     furl
, episode
, 'mp4', 'm3u8_native', 
  49                     m3u8_id
='hls', fatal
=False)) 
  53                     'format_id': determine_ext(furl
), 
  56         for (durl
, format_id
, width
, height
, filesize
) in re
.findall(r
'''(?x) 
  57                                    <a[^>]+?href="(?P<url>(?:https:)?//[^"]+)".*? 
  58                                    <strong>(?P<format_id>.+?)</strong>.*? 
  59                                    <small>(?:(?P<width>\d+)x(?P<height>\d+))?\s+?\((?P<filesize>[\d,]+\s*[GM]iB)\)</small> 
  63                 'format_id': format_id
, 
  64                 'width': int_or_none(width
), 
  65                 'height': int_or_none(height
), 
  66                 'filesize': parse_filesize(filesize
), 
  67                 'vcodec': 'none' if format_id
.startswith('Audio') else None, 
  70         self
._sort
_formats
(formats
, ('width', 'height', 'filesize', 'tbr')) 
  76             'thumbnail': thumbnail
,