]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ina.py
debian/changelog: Annotate bugs to close.
[youtubedl] / youtube_dl / extractor / ina.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class InaIE(InfoExtractor):
10 _VALID_URL = r'http://(?:www\.)?ina\.fr/video/(?P<id>I?[A-Z0-9]+)'
11 _TEST = {
12 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
13 'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
14 'info_dict': {
15 'id': 'I12055569',
16 'ext': 'mp4',
17 'title': 'François Hollande "Je crois que c\'est clair"',
18 }
19 }
20
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23
24 video_id = mobj.group('id')
25 mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id
26 info_doc = self._download_xml(mrss_url, video_id)
27
28 self.report_extraction(video_id)
29
30 video_url = info_doc.find('.//{http://search.yahoo.com/mrss/}player').attrib['url']
31
32 return {
33 'id': video_id,
34 'url': video_url,
35 'title': info_doc.find('.//title').text,
36 }