]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vrt.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
12 class VRTIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:deredactie|sporza|cobra(?:\.canvas)?)\.be/cm/(?:[^/]+/)+(?P<id>[^/]+)/*'
17 'url': 'http://deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_141025_JOL',
18 'md5': '4cebde1eb60a53782d4f3992cbd46ec8',
22 'title': 'Het journaal L - 25/10/14',
24 'timestamp': 1414271750.949,
25 'upload_date': '20141025',
28 'skip': 'HTTP Error 404: Not Found',
32 'url': 'http://sporza.be/cm/sporza/videozone/programmas/extratime/EP_141020_Extra_time',
33 'md5': '11f53088da9bf8e7cfc42456697953ff',
37 'title': 'Bekijk Extra Time van 20 oktober',
38 'description': 'md5:83ac5415a4f1816c6a93f8138aef2426',
39 'timestamp': 1413835980.560,
40 'upload_date': '20141020',
43 'skip': 'HTTP Error 404: Not Found',
47 'url': 'http://cobra.be/cm/cobra/videozone/rubriek/film-videozone/141022-mv-ellis-cafecorsari',
48 'md5': '78a2b060a5083c4f055449a72477409d',
52 'title': 'Bret Easton Ellis in Café Corsari',
53 'description': 'md5:f699986e823f32fd6036c1855a724ee9',
54 'timestamp': 1413967500.494,
55 'upload_date': '20141022',
58 'skip': 'HTTP Error 404: Not Found',
62 'url': 'http://deredactie.be/cm/vrtnieuws/videozone/nieuws/cultuurenmedia/1.2622957',
63 'md5': 'b8b93da1df1cea6c8556255a796b7d61',
67 'title': 'ROGUE ONE: A STAR WARS STORY Official Teaser Trailer',
68 'description': 'md5:8e468944dce15567a786a67f74262583',
69 'uploader': 'Star Wars',
70 'uploader_id': 'starwars',
71 'upload_date': '20160407',
73 'add_ie': ['Youtube'],
76 'url': 'http://cobra.canvas.be/cm/cobra/videozone/rubriek/film-videozone/1.2377055',
80 'title': 'Cafe Derby',
81 'description': 'Lenny Van Wesemael debuteert met de langspeelfilm Café Derby. Een waar gebeurd maar ook verzonnen verhaal.',
82 'upload_date': '20150626',
83 'timestamp': 1435305240.769,
87 'skip_download': True,
92 def _real_extract(self
, url
):
93 video_id
= self
._match
_id
(url
)
95 webpage
= self
._download
_webpage
(url
, video_id
)
97 video_id
= self
._search
_regex
(
98 r
'data-video-id="([^"]+)_[^"]+"', webpage
, 'video id', fatal
=False)
100 src
= self
._search
_regex
(
101 r
'data-video-src="([^"]+)"', webpage
, 'video src', default
=None)
103 video_type
= self
._search
_regex
(
104 r
'data-video-type="([^"]+)"', webpage
, 'video type', default
=None)
106 if video_type
== 'YouTubeVideo':
107 return self
.url_result(src
, 'Youtube')
112 r
'data-video-iphone-server="(?P<server>[^"]+)"\s+data-video-iphone-path="(?P<path>[^"]+)"',
115 formats
.extend(self
._extract
_m
3u8_formats
(
116 '%s/%s' % (mobj
.group('server'), mobj
.group('path')),
117 video_id
, 'mp4', m3u8_id
='hls', fatal
=False))
120 formats
= self
._extract
_wowza
_formats
(src
, video_id
)
121 if 'data-video-geoblocking="true"' not in webpage
:
123 if f
['url'].startswith('rtsp://'):
124 http_format
= f
.copy()
126 'url': f
['url'].replace('rtsp://', 'http://').replace('vod.', 'download.').replace('/_definst_/', '/').replace('mp4:', ''),
127 'format_id': f
['format_id'].replace('rtsp', 'http'),
130 formats
.append(http_format
)
132 if not formats
and 'data-video-geoblocking="true"' in webpage
:
133 self
.raise_geo_restricted('This video is only available in Belgium')
135 self
._sort
_formats
(formats
)
137 title
= self
._og
_search
_title
(webpage
)
138 description
= self
._og
_search
_description
(webpage
, default
=None)
139 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
140 timestamp
= float_or_none(self
._search
_regex
(
141 r
'data-video-sitestat-pubdate="(\d+)"', webpage
, 'timestamp', fatal
=False), 1000)
142 duration
= float_or_none(self
._search
_regex
(
143 r
'data-video-duration="(\d+)"', webpage
, 'duration', fatal
=False), 1000)
148 'description': description
,
149 'thumbnail': thumbnail
,
150 'timestamp': timestamp
,
151 'duration': duration
,