]>
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
):
13 https?://(?:www\.)?rtbf\.be/
16 ouftivi/(?:[^/]+/)*[^?]+\?.*\bvideoId=|
20 'url': 'https://www.rtbf.be/video/detail_les-diables-au-coeur-episode-2?id=1921274',
21 'md5': '799f334ddf2c0a582ba80c44655be570',
25 'title': 'Les Diables au coeur (épisode 2)',
26 'description': 'Football - Diables Rouges',
28 'upload_date': '20140425',
29 'timestamp': 1398456336,
30 'uploader': 'rtbfsport',
34 'url': 'http://www.rtbf.be/ouftivi/heros/detail_scooby-doo-mysteres-associes?id=1097&videoId=2057442',
35 'only_matching': True,
37 'url': 'http://www.rtbf.be/ouftivi/niouzz?videoId=2055858',
38 'only_matching': True,
40 'url': 'http://www.rtbf.be/auvio/detail_jeudi-en-prime-siegfried-bracke?id=2102996',
41 'only_matching': True,
43 _IMAGE_HOST
= 'http://ds1.ds.static.rtbf.be'
46 'DAILYMOTION': 'Dailymotion',
55 def _real_extract(self
, url
):
56 video_id
= self
._match
_id
(url
)
57 data
= self
._download
_json
(
58 'http://www.rtbf.be/api/media/video?method=getVideoDetail&args[]=%s' % video_id
, video_id
)
60 error
= data
.get('error')
62 raise ExtractorError('%s said: %s' % (self
.IE_NAME
, error
), expected
=True)
66 provider
= data
.get('provider')
67 if provider
in self
._PROVIDERS
:
68 return self
.url_result(data
['url'], self
._PROVIDERS
[provider
])
71 for key
, format_id
in self
._QUALITIES
:
72 format_url
= data
.get(key
+ 'Url')
75 'format_id': format_id
,
80 for thumbnail_id
, thumbnail_url
in data
.get('thumbnail', {}).items():
81 if thumbnail_id
!= 'default':
83 'url': self
._IMAGE
_HOST
+ thumbnail_url
,
90 'title': data
['title'],
91 'description': data
.get('description') or data
.get('subtitle'),
92 'thumbnails': thumbnails
,
93 'duration': data
.get('duration') or data
.get('realDuration'),
94 'timestamp': int_or_none(data
.get('created')),
95 'view_count': int_or_none(data
.get('viewCount')),
96 'uploader': data
.get('channel'),
97 'tags': data
.get('tags'),