]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/canalc2.py
Imported Upstream version 2013.10.23
[youtubedl] / youtube_dl / extractor / canalc2.py
1 # coding: utf-8
2 import re
3
4 from .common import InfoExtractor
5
6
7 class Canalc2IE(InfoExtractor):
8 IE_NAME = 'canalc2.tv'
9 _VALID_URL = r'http://.*?\.canalc2\.tv/video\.asp\?idVideo=(\d+)&voir=oui'
10
11 _TEST = {
12 u'url': u'http://www.canalc2.tv/video.asp?idVideo=12163&voir=oui',
13 u'file': u'12163.mp4',
14 u'md5': u'060158428b650f896c542dfbb3d6487f',
15 u'info_dict': {
16 u'title': u'Terrasses du Numérique'
17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = re.match(self._VALID_URL, url).group(1)
22 webpage = self._download_webpage(url, video_id)
23 file_name = self._search_regex(
24 r"so\.addVariable\('file','(.*?)'\);",
25 webpage, 'file name')
26 video_url = 'http://vod-flash.u-strasbg.fr:8080/' + file_name
27
28 title = self._html_search_regex(
29 r'class="evenement8">(.*?)</a>', webpage, u'title')
30
31 return {'id': video_id,
32 'ext': 'mp4',
33 'url': video_url,
34 'title': title,
35 }