[ina] add support for audio URLs

This commit is contained in:
Remita Amine 2019-03-27 18:49:29 +01:00
parent b27a71e66c
commit c4c888697e
1 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
determine_ext,
int_or_none, int_or_none,
strip_or_none, strip_or_none,
xpath_attr, xpath_attr,
@ -11,7 +12,7 @@ from ..utils import (
class InaIE(InfoExtractor): class InaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ina\.fr/video/(?P<id>[A-Z0-9_]+)' _VALID_URL = r'https?://(?:www\.)?ina\.fr/(?:video|audio)/(?P<id>[A-Z0-9_]+)'
_TESTS = [{ _TESTS = [{
'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html', 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
'md5': 'a667021bf2b41f8dc6049479d9bb38a3', 'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
@ -24,6 +25,12 @@ class InaIE(InfoExtractor):
}, { }, {
'url': 'https://www.ina.fr/video/S806544_001/don-d-organes-des-avancees-mais-d-importants-besoins-video.html', 'url': 'https://www.ina.fr/video/S806544_001/don-d-organes-des-avancees-mais-d-importants-besoins-video.html',
'only_matching': True, 'only_matching': True,
}, {
'url': 'https://www.ina.fr/audio/P16173408',
'only_matching': True,
}, {
'url': 'https://www.ina.fr/video/P16173408-video.html',
'only_matching': True,
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -48,8 +55,12 @@ class InaIE(InfoExtractor):
'height': h, 'height': h,
}) })
if not formats: if not formats:
furl = get_furl('player') or content.attrib['url']
ext = determine_ext(furl)
formats = [{ formats = [{
'url': get_furl('player') or content.attrib['url'], 'url': furl,
'vcodec': 'none' if ext == 'mp3' else None,
'ext': ext,
}] }]
thumbnails = [] thumbnails = []