]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vrt.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import float_or_none
 
  10 class VRTIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:deredactie|sporza|cobra(?:\.canvas)?)\.be/cm/(?:[^/]+/)+(?P<id>[^/]+)/*' 
  15             'url': 'http://deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_141025_JOL', 
  16             'md5': '4cebde1eb60a53782d4f3992cbd46ec8', 
  20                 'title': 'Het journaal L - 25/10/14', 
  22                 'timestamp': 1414271750.949, 
  23                 'upload_date': '20141025', 
  29             'url': 'http://sporza.be/cm/sporza/videozone/programmas/extratime/EP_141020_Extra_time', 
  30             'md5': '11f53088da9bf8e7cfc42456697953ff', 
  34                 'title': 'Bekijk Extra Time van 20 oktober', 
  35                 'description': 'md5:83ac5415a4f1816c6a93f8138aef2426', 
  36                 'timestamp': 1413835980.560, 
  37                 'upload_date': '20141020', 
  43             'url': 'http://cobra.be/cm/cobra/videozone/rubriek/film-videozone/141022-mv-ellis-cafecorsari', 
  44             'md5': '78a2b060a5083c4f055449a72477409d', 
  48                 'title': 'Bret Easton Ellis in Café Corsari', 
  49                 'description': 'md5:f699986e823f32fd6036c1855a724ee9', 
  50                 'timestamp': 1413967500.494, 
  51                 'upload_date': '20141022', 
  56             'url': 'http://cobra.canvas.be/cm/cobra/videozone/rubriek/film-videozone/1.2377055', 
  57             'only_matching': True, 
  61     def _real_extract(self
, url
): 
  62         video_id 
= self
._match
_id
(url
) 
  64         webpage 
= self
._download
_webpage
(url
, video_id
) 
  66         video_id 
= self
._search
_regex
( 
  67             r
'data-video-id="([^"]+)_[^"]+"', webpage
, 'video id', fatal
=False) 
  71             r
'data-video-iphone-server="(?P<server>[^"]+)"\s+data-video-iphone-path="(?P<path>[^"]+)"', 
  74             formats
.extend(self
._extract
_m
3u8_formats
( 
  75                 '%s/%s' % (mobj
.group('server'), mobj
.group('path')), 
  76                 video_id
, 'mp4', m3u8_id
='hls', fatal
=False)) 
  77         mobj 
= re
.search(r
'data-video-src="(?P<src>[^"]+)"', webpage
) 
  79             formats
.extend(self
._extract
_f
4m
_formats
( 
  80                 '%s/manifest.f4m' % mobj
.group('src'), 
  81                 video_id
, f4m_id
='hds', fatal
=False)) 
  83         if not formats 
and 'data-video-geoblocking="true"' in webpage
: 
  84             self
.raise_geo_restricted('This video is only available in Belgium') 
  86         self
._sort
_formats
(formats
) 
  88         title 
= self
._og
_search
_title
(webpage
) 
  89         description 
= self
._og
_search
_description
(webpage
, default
=None) 
  90         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  91         timestamp 
= float_or_none(self
._search
_regex
( 
  92             r
'data-video-sitestat-pubdate="(\d+)"', webpage
, 'timestamp', fatal
=False), 1000) 
  93         duration 
= float_or_none(self
._search
_regex
( 
  94             r
'data-video-duration="(\d+)"', webpage
, 'duration', fatal
=False), 1000) 
  99             'description': description
, 
 100             'thumbnail': thumbnail
, 
 101             'timestamp': timestamp
, 
 102             'duration': duration
,