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)',
31 def _real_extract(self, url):
32 video_id = self._match_id(url)
34 webpage = self._download_webpage(
35 'http://www.rtbf.be/video/embed?id=%s' % video_id, video_id)
37 data = self._parse_json(
38 unescapeHTML(self._search_regex(
39 r'data-media="([^"]+)"', webpage, 'data video')),
42 if data.get('provider').lower() == 'youtube':
43 video_url = data.get('downloadUrl') or data.get('url')
44 return self.url_result(video_url, 'Youtube')
46 for key, format_id in self._QUALITIES:
47 format_url = data['sources'].get(key)
50 'format_id': format_id,
57 'title': data['title'],
58 'description': data.get('description') or data.get('subtitle'),
59 'thumbnail': data.get('thumbnail'),
60 'duration': data.get('duration') or data.get('realDuration'),
61 'timestamp': int_or_none(data.get('created')),
62 'view_count': int_or_none(data.get('viewCount')),