]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/ina.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
14 class InaIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:(?:www|m)\.)?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,
35 'url': 'http://m.ina.fr/video/I12055569',
36 'only_matching': True,
39 def _real_extract(self
, url
):
40 video_id
= self
._match
_id
(url
)
41 info_doc
= self
._download
_xml
(
42 'http://player.ina.fr/notices/%s.mrss' % video_id
, video_id
)
43 item
= info_doc
.find('channel/item')
44 title
= xpath_text(item
, 'title', fatal
=True)
45 media_ns_xpath
= lambda x
: self
._xpath
_ns
(x
, 'http://search.yahoo.com/mrss/')
46 content
= item
.find(media_ns_xpath('content'))
48 get_furl
= lambda x
: xpath_attr(content
, media_ns_xpath(x
), 'url')
50 for q
, w
, h
in (('bq', 400, 300), ('mq', 512, 384), ('hq', 768, 576)):
61 furl
= get_furl('player') or content
.attrib
['url']
62 ext
= determine_ext(furl
)
65 'vcodec': 'none' if ext
== 'mp3' else None,
70 for thumbnail
in content
.findall(media_ns_xpath('thumbnail')):
71 thumbnail_url
= thumbnail
.get('url')
76 'height': int_or_none(thumbnail
.get('height')),
77 'width': int_or_none(thumbnail
.get('width')),
84 'description': strip_or_none(xpath_text(item
, 'description')),
85 'thumbnails': thumbnails
,