]>
Commit | Line | Data |
---|---|---|
cd0abcc0 | 1 | # coding: utf-8 |
0568c352 PH |
2 | from __future__ import unicode_literals |
3 | ||
cd0abcc0 | 4 | import re |
cd0abcc0 PR |
5 | |
6 | from .common import InfoExtractor | |
7 | ||
e86ea47c | 8 | |
cd0abcc0 | 9 | class Canalc2IE(InfoExtractor): |
6b361ad5 | 10 | IE_NAME = 'canalc2.tv' |
19b06682 | 11 | _VALID_URL = r'http://.*?\.canalc2\.tv/video\.asp\?.*?idVideo=(?P<id>\d+)' |
cd0abcc0 PR |
12 | |
13 | _TEST = { | |
0568c352 PH |
14 | 'url': 'http://www.canalc2.tv/video.asp?idVideo=12163&voir=oui', |
15 | 'md5': '060158428b650f896c542dfbb3d6487f', | |
16 | 'info_dict': { | |
17 | 'id': '12163', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Terrasses du Numérique' | |
cd0abcc0 PR |
20 | } |
21 | } | |
22 | ||
23 | def _real_extract(self, url): | |
19b06682 JMF |
24 | video_id = re.match(self._VALID_URL, url).group('id') |
25 | # We need to set the voir field for getting the file name | |
26 | url = 'http://www.canalc2.tv/video.asp?idVideo=%s&voir=oui' % video_id | |
cd0abcc0 | 27 | webpage = self._download_webpage(url, video_id) |
e86ea47c PH |
28 | file_name = self._search_regex( |
29 | r"so\.addVariable\('file','(.*?)'\);", | |
30 | webpage, 'file name') | |
cd0abcc0 | 31 | video_url = 'http://vod-flash.u-strasbg.fr:8080/' + file_name |
ff242459 | 32 | |
e86ea47c | 33 | title = self._html_search_regex( |
0568c352 PH |
34 | r'class="evenement8">(.*?)</a>', webpage, 'title') |
35 | ||
36 | return { | |
37 | 'id': video_id, | |
38 | 'ext': 'mp4', | |
39 | 'url': video_url, | |
40 | 'title': title, | |
41 | } |