]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rtbf.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
10 class RTBFIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://www.rtbf.be/video/[^\?]+\?id=(?P<id>\d+)'
13 'url': 'https://www.rtbf.be/video/detail_les-diables-au-coeur-episode-2?id=1921274',
14 'md5': '799f334ddf2c0a582ba80c44655be570',
18 'title': 'Les Diables au coeur (épisode 2)',
19 'description': 'Football - Diables Rouges',
21 'timestamp': 1398456336,
22 'upload_date': '20140425',
26 def _real_extract(self
, url
):
27 mobj
= re
.match(self
._VALID
_URL
, url
)
28 video_id
= mobj
.group('id')
30 page
= self
._download
_webpage
('https://www.rtbf.be/video/embed?id=%s' % video_id
, video_id
)
32 data
= json
.loads(self
._html
_search
_regex
(
33 r
'<div class="js-player-embed" data-video="([^"]+)"', page
, 'data video'))['data']
35 video_url
= data
.get('downloadUrl') or data
.get('url')
37 if data
['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
['thumbnail']['large'],
46 'duration': data
.get('duration') or data
.get('realDuration'),
47 'timestamp': data
['created'],
48 'view_count': data
['viewCount'],