]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/ina.py
[cwtv] fix episode number extraction(closes #20461)
[yt-dlp.git] / youtube_dl / extractor / ina.py
CommitLineData
dcdb292f 1# coding: utf-8
de563c9d
JMF
2from __future__ import unicode_literals
3
9fe4de34
PH
4import re
5
6from .common import InfoExtractor
7
8
9class InaIE(InfoExtractor):
c05724cb 10 _VALID_URL = r'https?://(?:www\.)?ina\.fr/video/(?P<id>I?[A-Z0-9]+)'
6f5ac90c 11 _TEST = {
de563c9d
JMF
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"',
6f5ac90c
PH
18 }
19 }
9fe4de34 20
de563c9d 21 def _real_extract(self, url):
9fe4de34
PH
22 mobj = re.match(self._VALID_URL, url)
23
24 video_id = mobj.group('id')
de563c9d
JMF
25 mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id
26 info_doc = self._download_xml(mrss_url, video_id)
9fe4de34
PH
27
28 self.report_extraction(video_id)
29
de563c9d 30 video_url = info_doc.find('.//{http://search.yahoo.com/mrss/}player').attrib['url']
9fe4de34 31
de563c9d
JMF
32 return {
33 'id': video_id,
34 'url': video_url,
35 'title': info_doc.find('.//title').text,
36 }