]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/canalc2.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import parse_duration
10 class Canalc2IE(InfoExtractor
):
11 IE_NAME
= 'canalc2.tv'
12 _VALID_URL
= r
'https?://(?:(?:www\.)?canalc2\.tv/video/|archives-canalc2\.u-strasbg\.fr/video\.asp\?.*\bidVideo=)(?P<id>\d+)'
15 'url': 'http://www.canalc2.tv/video/12163',
16 'md5': '060158428b650f896c542dfbb3d6487f',
20 'title': 'Terrasses du Numérique',
24 'url': 'http://archives-canalc2.u-strasbg.fr/video.asp?idVideo=11427&voir=oui',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
31 webpage
= self
._download
_webpage
(
32 'http://www.canalc2.tv/video/%s' % video_id
, video_id
)
34 title
= self
._html
_search
_regex
(
35 r
'(?s)class="[^"]*col_description[^"]*">.*?<h3>(.+?)</h3>',
39 for _
, video_url
in re
.findall(r
'file\s*=\s*(["\'])(.+?
)\
1', webpage):
40 if video_url.startswith('rtmp
://'):
42 r'^
(?P
<url
>rtmp
://[^
/]+/(?P
<app
>.+/))(?P
<play_path
>mp4
:.+)$
', video_url)
44 'url
': rtmp.group('url
'),
47 'app
': rtmp.group('app
'),
48 'play_path
': rtmp.group('play_path
'),
62 info = self._parse_html5_media_entries(url, webpage, url)[0]
64 self._sort_formats(info['formats
'])
69 'duration
': parse_duration(self._search_regex(
70 r'id=["\']video_duree["\'][^
>]*>([^
<]+)',
71 webpage, 'duration
', fatal=False)),