2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from .brightcove import BrightcoveNewIE
10 class TVANouvellesIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?tvanouvelles\.ca/videos/(?P<id>\d+)'
13 'url': 'http://www.tvanouvelles.ca/videos/5117035533001',
15 'id': '5117035533001',
17 'title': 'L’industrie du taxi dénonce l’entente entre Québec et Uber: explications',
18 'description': 'md5:479653b7c8cf115747bf5118066bd8b3',
19 'uploader_id': '1741764581',
20 'timestamp': 1473352030,
21 'upload_date': '20160908',
23 'add_ie': ['BrightcoveNew'],
25 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1741764581/default_default/index.html?videoId=%s'
27 def _real_extract(self, url):
28 brightcove_id = self._match_id(url)
29 return self.url_result(
30 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
31 BrightcoveNewIE.ie_key(), brightcove_id)
34 class TVANouvellesArticleIE(InfoExtractor):
35 _VALID_URL = r'https?://(?:www\.)?tvanouvelles\.ca/(?:[^/]+/)+(?P<id>[^/?#&]+)'
37 'url': 'http://www.tvanouvelles.ca/2016/11/17/des-policiers-qui-ont-la-meche-un-peu-courte',
39 'id': 'des-policiers-qui-ont-la-meche-un-peu-courte',
40 'title': 'Des policiers qui ont «la mèche un peu courte»?',
41 'description': 'md5:92d363c8eb0f0f030de9a4a84a90a3a0',
43 'playlist_mincount': 4,
47 def suitable(cls, url):
48 return False if TVANouvellesIE.suitable(url) else super(TVANouvellesArticleIE, cls).suitable(url)
50 def _real_extract(self, url):
51 display_id = self._match_id(url)
53 webpage = self._download_webpage(url, display_id)
57 'http://www.tvanouvelles.ca/videos/%s' % mobj.group('id'),
58 ie=TVANouvellesIE.ie_key(), video_id=mobj.group('id'))
59 for mobj in re.finditer(
60 r'data-video-id=(["\'])?(?P<id>\d+)', webpage)]
62 title = self._og_search_title(webpage, fatal=False)
63 description = self._og_search_description(webpage)
65 return self.playlist_result(entries, display_id, title, description)