2 from __future__ import unicode_literals
4 from .common import InfoExtractor
14 class InaIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?ina\.fr/(?:video|audio)/(?P<id>[A-Z0-9_]+)'
17 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
18 'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
22 'title': 'François Hollande "Je crois que c\'est clair"',
23 'description': 'md5:3f09eb072a06cb286b8f7e4f77109663',
26 'url': 'https://www.ina.fr/video/S806544_001/don-d-organes-des-avancees-mais-d-importants-besoins-video.html',
27 'only_matching': True,
29 'url': 'https://www.ina.fr/audio/P16173408',
30 'only_matching': True,
32 'url': 'https://www.ina.fr/video/P16173408-video.html',
33 'only_matching': True,
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
38 info_doc = self._download_xml(
39 'http://player.ina.fr/notices/%s.mrss' % video_id, video_id)
40 item = info_doc.find('channel/item')
41 title = xpath_text(item, 'title', fatal=True)
42 media_ns_xpath = lambda x: self._xpath_ns(x, 'http://search.yahoo.com/mrss/')
43 content = item.find(media_ns_xpath('content'))
45 get_furl = lambda x: xpath_attr(content, media_ns_xpath(x), 'url')
47 for q, w, h in (('bq', 400, 300), ('mq', 512, 384), ('hq', 768, 576)):
58 furl = get_furl('player') or content.attrib['url']
59 ext = determine_ext(furl)
62 'vcodec': 'none' if ext == 'mp3' else None,
67 for thumbnail in content.findall(media_ns_xpath('thumbnail')):
68 thumbnail_url = thumbnail.get('url')
73 'height': int_or_none(thumbnail.get('height')),
74 'width': int_or_none(thumbnail.get('width')),
81 'description': strip_or_none(xpath_text(item, 'description')),
82 'thumbnails': thumbnails,