]>
Commit | Line | Data |
---|---|---|
cd0abcc0 PR |
1 | # coding: utf-8 |
2 | """Extractor for canalc2.tv""" | |
3 | import re | |
4 | import lxml.html | |
5 | ||
6 | from .common import InfoExtractor | |
7 | ||
8 | class Canalc2IE(InfoExtractor): | |
9 | """Extractor for canalc2.tv""" | |
10 | _VALID_URL = r'http://.*?\.canalc2\.tv/video\.asp\?idVideo=(\d+)&voir=oui' | |
11 | ||
12 | _TEST = { | |
13 | u'url': u'http://www.canalc2.tv/video.asp?idVideo=12163&voir=oui', | |
14 | u'file': u'12163.mp4', | |
15 | u'md5': u'c00fa80517373764ff5c0b5eb5a58780', | |
16 | u'info_dict': { | |
17 | u'title': u'Terrasses du Numérique' | |
18 | } | |
19 | } | |
20 | ||
21 | def _real_extract(self, url): | |
22 | video_id = re.match(self._VALID_URL, url).group(1) | |
23 | webpage = self._download_webpage(url, video_id) | |
24 | file_name = re.search(r"so\.addVariable\('file','(.*?)'\);", | |
25 | webpage).group(1) | |
26 | ||
27 | video_url = 'http://vod-flash.u-strasbg.fr:8080/' + file_name | |
28 | ||
29 | html = lxml.html.fromstring(webpage) | |
30 | ||
31 | title = html.cssselect('.evenement8')[0].text_content() | |
32 | ||
33 | return {'id': video_id, | |
34 | 'ext' : 'mp4', | |
35 | 'url' : video_url, | |
36 | 'title' : title | |
37 | } |