]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mitele.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  12 class MiTeleIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?mitele\.es/(?:[^/]+/)+(?P<id>[^/]+)/player' 
  17         'url': 'http://www.mitele.es/programas-tv/diario-de/57b0dfb9c715da65618b4afa/player', 
  19             'id': 'FhYW1iNTE6J6H7NkQRIEzfne6t2quqPg', 
  21             'title': 'Diario de La redacción Programa 144', 
  22             'description': 'md5:07c35a7b11abb05876a6a79185b58d27', 
  23             'series': 'Diario de', 
  24             'season': 'Season 14', 
  26             'episode': 'Tor, la web invisible', 
  28             'thumbnail': r
're:(?i)^https?://.*\.jpg$', 
  31             'timestamp': 1471209401, 
  32             'upload_date': '20160814', 
  37         'url': 'http://www.mitele.es/programas-tv/cuarto-milenio/57b0de3dc915da14058b4876/player', 
  39             'id': 'oyNG1iNTE6TAPP-JmCjbwfwJqqMMX3Vq', 
  41             'title': 'Cuarto Milenio Temporada 6 Programa 226', 
  42             'description': 'md5:5ff132013f0cd968ffbf1f5f3538a65f', 
  43             'series': 'Cuarto Milenio', 
  46             'episode': 'Episode 24', 
  48             'thumbnail': r
're:(?i)^https?://.*\.jpg$', 
  51             'timestamp': 1471209021, 
  52             'upload_date': '20160814', 
  55             'skip_download': True, 
  59         'url': 'http://www.mitele.es/series-online/la-que-se-avecina/57aac5c1c915da951a8b45ed/player', 
  60         'only_matching': True, 
  62         'url': 'https://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144-40_1006364575251/player/', 
  63         'only_matching': True, 
  66     def _real_extract(self
, url
): 
  67         display_id 
= self
._match
_id
(url
) 
  68         webpage 
= self
._download
_webpage
(url
, display_id
) 
  69         pre_player 
= self
._parse
_json
(self
._search
_regex
( 
  70             r
'window\.\$REACTBASE_STATE\.prePlayer_mtweb\s*=\s*({.+})', 
  71             webpage
, 'Pre Player'), display_id
)['prePlayer'] 
  72         title 
= pre_player
['title'] 
  73         video 
= pre_player
['video'] 
  74         video_id 
= video
['dataMediaId'] 
  75         content 
= pre_player
.get('content') or {} 
  76         info 
= content
.get('info') or {} 
  79             '_type': 'url_transparent', 
  80             # for some reason only HLS is supported 
  81             'url': smuggle_url('ooyala:' + video_id
, {'supportedformats': 'm3u8,dash'}), 
  84             'description': info
.get('synopsis'), 
  85             'series': content
.get('title'), 
  86             'season_number': int_or_none(info
.get('season_number')), 
  87             'episode': content
.get('subtitle'), 
  88             'episode_number': int_or_none(info
.get('episode_number')), 
  89             'duration': int_or_none(info
.get('duration')), 
  90             'thumbnail': video
.get('dataPoster'), 
  91             'age_limit': int_or_none(info
.get('rating')), 
  92             'timestamp': parse_iso8601(pre_player
.get('publishedTime')),