]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ina.py
debian/control: Add mplayer{,2} as recommends.
[youtubedl] / youtube_dl / extractor / ina.py
1 import re
2
3 from .common import InfoExtractor
4
5
6 class InaIE(InfoExtractor):
7 """Information Extractor for Ina.fr"""
8 _VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I[0-9]+)/.*'
9
10 def _real_extract(self,url):
11 mobj = re.match(self._VALID_URL, url)
12
13 video_id = mobj.group('id')
14 mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
15 video_extension = 'mp4'
16 webpage = self._download_webpage(mrss_url, video_id)
17
18 self.report_extraction(video_id)
19
20 video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
21 webpage, u'video URL')
22
23 video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
24 webpage, u'title')
25
26 return [{
27 'id': video_id,
28 'url': video_url,
29 'ext': video_extension,
30 'title': video_title,
31 }]