]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ina.py
652f19b7b8ea689d7861b04f6ff421c144c300d9
[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?[A-F0-9]+)/.*'
9 _TEST = {
10 u'url': u'www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
11 u'file': u'I12055569.mp4',
12 u'md5': u'a667021bf2b41f8dc6049479d9bb38a3',
13 u'info_dict': {
14 u"title": u"Fran\u00e7ois Hollande \"Je crois que c'est clair\""
15 }
16 }
17
18 def _real_extract(self,url):
19 mobj = re.match(self._VALID_URL, url)
20
21 video_id = mobj.group('id')
22 mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
23 video_extension = 'mp4'
24 webpage = self._download_webpage(mrss_url, video_id)
25
26 self.report_extraction(video_id)
27
28 video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
29 webpage, u'video URL')
30
31 video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
32 webpage, u'title')
33
34 return [{
35 'id': video_id,
36 'url': video_url,
37 'ext': video_extension,
38 'title': video_title,
39 }]