2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from .brightcove import BrightcoveNewIE
16 class VrakIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?vrak\.tv/videos\?.*?\btarget=(?P<id>[\d.]+)'
19 'url': 'http://www.vrak.tv/videos?target=1.2306782&filtre=emission&id=1.1806721',
21 'id': '5345661243001',
23 'title': 'Obésité, film de hockey et Roseline Filion',
24 'timestamp': 1488492126,
25 'upload_date': '20170302',
26 'uploader_id': '2890187628001',
29 'series': 'ALT (Actualité Légèrement Tordue)',
30 'episode': 'Obésité, film de hockey et Roseline Filion',
34 'skip_download': True,
37 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/2890187628001/default_default/index.html?videoId=%s'
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
44 title = self._html_search_regex(
45 r'<h\d\b[^>]+\bclass=["\']videoTitle["\'][^>]*>([^<]+)',
46 webpage, 'title', default=None) or self._og_search_title(webpage)
48 content = self._parse_json(
50 r'data-player-options-content=(["\'])(?P<content>{.+?})\1',
51 webpage, 'content', default='{}', group='content'),
52 video_id, transform_source=unescapeHTML)
54 ref_id = content.get('refId') or self._search_regex(
55 r'refId":"([^&]+)"', webpage, 'ref id')
57 brightcove_id = self._search_regex(
59 java\.lang\.String\s+value\s*=\s*["']brightcove\.article\.\d+\.%s
61 java\.lang\.String\s+value\s*=\s*["'](\d+)
62 ''' % re.escape(ref_id), webpage, 'brightcove id')
65 '_type': 'url_transparent',
66 'ie_key': BrightcoveNewIE.ie_key(),
68 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
69 {'geo_countries': ['CA']}),
71 'description': content.get('description'),
72 'creator': content.get('brand'),
73 'age_limit': parse_age_limit(content.get('rating')),
74 'series': content.get('showName') or content.get(
75 'episodeName'), # this is intentional
76 'season_number': int_or_none(content.get('seasonNumber')),
78 'episode_number': int_or_none(content.get('episodeNumber')),
79 'tags': content.get('tags', []),