]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rtlnl.py
5daef2fc5656191ea2cc0c411d520b0b0f5cd455
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import parse_duration
 
   9 class RtlXlIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://www\.rtlxl\.nl/#!/[^/]+/(?P<uuid>[^/?]+)' 
  14         'url': 'http://www.rtlxl.nl/#!/rtl-nieuws-132237/6e4203a6-0a5e-3596-8424-c599a59e0677', 
  15         'md5': 'cc16baa36a6c169391f0764fa6b16654', 
  17             'id': '6e4203a6-0a5e-3596-8424-c599a59e0677', 
  19             'title': 'RTL Nieuws - Laat', 
  20             'description': 'md5:6b61f66510c8889923b11f2778c72dc5', 
  21             'timestamp': 1408051800, 
  22             'upload_date': '20140814', 
  27     def _real_extract(self
, url
): 
  28         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  29         uuid 
= mobj
.group('uuid') 
  31         # Use m3u8 streams (see https://github.com/rg3/youtube-dl/issues/4118) 
  32         info 
= self
._download
_json
( 
  33             'http://www.rtl.nl/system/s4m/vfd/version=2/uuid=%s/d=pc/fmt=adaptive/' % uuid
, 
  36         material 
= info
['material'][0] 
  37         episode_info 
= info
['episodes'][0] 
  39         progname 
= info
['abstracts'][0]['name'] 
  40         subtitle 
= material
['title'] or info
['episodes'][0]['name'] 
  42         videopath 
= material
['videopath'] 
  43         m3u8_url 
= 'http://manifest.us.rtl.nl' + videopath
 
  45         formats 
= self
._extract
_m
3u8_formats
(m3u8_url
, uuid
, ext
='mp4') 
  47         video_urlpart 
= videopath
.split('/adaptive/')[1][:-4] 
  48         PG_URL_TEMPLATE 
= 'http://pg.us.rtl.nl/rtlxl/network/%s/progressive/%s.mp4' 
  52                 'url': PG_URL_TEMPLATE 
% ('a2m', video_urlpart
), 
  56                 'url': PG_URL_TEMPLATE 
% ('a3m', video_urlpart
), 
  62         self
._sort
_formats
(formats
) 
  66             'title': '%s - %s' % (progname
, subtitle
), 
  68             'timestamp': material
['original_date'], 
  69             'description': episode_info
['synopsis'], 
  70             'duration': parse_duration(material
.get('duration')),