]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vrt.py
8e35f24e81e7e61240898ea3259914737365fd2f
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class VRTIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:deredactie|sporza|cobra(?:\.canvas)?)\.be/cm/(?:[^/]+/)+(?P<id>[^/]+)/*'
18 'url': 'http://deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_141025_JOL',
19 'md5': '4cebde1eb60a53782d4f3992cbd46ec8',
23 'title': 'Het journaal L - 25/10/14',
25 'timestamp': 1414271750.949,
26 'upload_date': '20141025',
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',
46 'url': 'http://cobra.be/cm/cobra/videozone/rubriek/film-videozone/141022-mv-ellis-cafecorsari',
47 'md5': '78a2b060a5083c4f055449a72477409d',
51 'title': 'Bret Easton Ellis in Café Corsari',
52 'description': 'md5:f699986e823f32fd6036c1855a724ee9',
53 'timestamp': 1413967500.494,
54 'upload_date': '20141022',
60 'url': 'http://deredactie.be/cm/vrtnieuws/videozone/nieuws/cultuurenmedia/1.2622957',
61 'only_matching': True,
64 'url': 'http://cobra.canvas.be/cm/cobra/videozone/rubriek/film-videozone/1.2377055',
65 'only_matching': True,
69 def _real_extract(self
, url
):
70 video_id
= self
._match
_id
(url
)
72 webpage
= self
._download
_webpage
(url
, video_id
)
74 video_id
= self
._search
_regex
(
75 r
'data-video-id="([^"]+)_[^"]+"', webpage
, 'video id', fatal
=False)
77 src
= self
._search
_regex
(
78 r
'data-video-src="([^"]+)"', webpage
, 'video src', default
=None)
80 video_type
= self
._search
_regex
(
81 r
'data-video-type="([^"]+)"', webpage
, 'video type', default
=None)
83 if video_type
== 'YouTubeVideo':
84 return self
.url_result(src
, 'Youtube')
89 r
'data-video-iphone-server="(?P<server>[^"]+)"\s+data-video-iphone-path="(?P<path>[^"]+)"',
92 formats
.extend(self
._extract
_m
3u8_formats
(
93 '%s/%s' % (mobj
.group('server'), mobj
.group('path')),
94 video_id
, 'mp4', m3u8_id
='hls', fatal
=False))
97 if determine_ext(src
) == 'm3u8':
98 formats
.extend(self
._extract
_m
3u8_formats
(
99 src
, video_id
, 'mp4', entry_protocol
='m3u8_native',
100 m3u8_id
='hls', fatal
=False))
102 formats
.extend(self
._extract
_f
4m
_formats
(
103 '%s/manifest.f4m' % src
, video_id
, f4m_id
='hds', fatal
=False))
105 if not formats
and 'data-video-geoblocking="true"' in webpage
:
106 self
.raise_geo_restricted('This video is only available in Belgium')
108 self
._sort
_formats
(formats
)
110 title
= self
._og
_search
_title
(webpage
)
111 description
= self
._og
_search
_description
(webpage
, default
=None)
112 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
113 timestamp
= float_or_none(self
._search
_regex
(
114 r
'data-video-sitestat-pubdate="(\d+)"', webpage
, 'timestamp', fatal
=False), 1000)
115 duration
= float_or_none(self
._search
_regex
(
116 r
'data-video-duration="(\d+)"', webpage
, 'duration', fatal
=False), 1000)
121 'description': description
,
122 'thumbnail': thumbnail
,
123 'timestamp': timestamp
,
124 'duration': duration
,