]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rtbf.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class RTBFIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://www.rtbf.be/video/[^\?]+\?id=(?P<id>\d+)'
14 'url': 'https://www.rtbf.be/video/detail_les-diables-au-coeur-episode-2?id=1921274',
15 'md5': '799f334ddf2c0a582ba80c44655be570',
19 'title': 'Les Diables au coeur (épisode 2)',
24 def _real_extract(self
, url
):
25 video_id
= self
._match
_id
(url
)
27 webpage
= self
._download
_webpage
(
28 'http://www.rtbf.be/video/embed?id=%s' % video_id
, video_id
)
30 data
= self
._parse
_json
(
31 unescapeHTML(self
._search
_regex
(
32 r
'data-video="([^"]+)"', webpage
, 'data video')),
35 video_url
= data
.get('downloadUrl') or data
.get('url')
37 if data
.get('provider').lower() == 'youtube':
38 return self
.url_result(video_url
, 'Youtube')
43 'title': data
['title'],
44 'description': data
.get('description') or data
.get('subtitle'),
45 'thumbnail': data
.get('thumbnail'),
46 'duration': data
.get('duration') or data
.get('realDuration'),
47 'timestamp': int_or_none(data
.get('created')),
48 'view_count': int_or_none(data
.get('viewCount')),