mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-09 13:13:06 +08:00
franceinter download video when available (ignoring audio)
This commit is contained in:
parent
19a352854f
commit
cc504ab6c1
@ -1,6 +1,8 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import month_by_name
|
||||
|
||||
@ -8,26 +10,53 @@ from ..utils import month_by_name
|
||||
class FranceInterIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)'
|
||||
|
||||
_TEST = {
|
||||
'url': 'https://www.franceinter.fr/emissions/affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
||||
'md5': '9e54d7bdb6fdc02a841007f8a975c094',
|
||||
'info_dict': {
|
||||
'id': 'affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
||||
'ext': 'mp3',
|
||||
'title': 'Affaire Cahuzac : le contentieux du compte en Suisse',
|
||||
'description': 'md5:401969c5d318c061f86bda1fa359292b',
|
||||
'upload_date': '20160907',
|
||||
_TESTS = [
|
||||
{
|
||||
'url': 'https://www.franceinter.fr/emissions/affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
||||
'md5': '9e54d7bdb6fdc02a841007f8a975c094',
|
||||
'info_dict': {
|
||||
'id': 'affaires-sensibles/affaires-sensibles-07-septembre-2016',
|
||||
'ext': 'mp3',
|
||||
'title': 'Affaire Cahuzac : le contentieux du compte en Suisse',
|
||||
'description': 'md5:401969c5d318c061f86bda1fa359292b',
|
||||
'upload_date': '20160907',
|
||||
},
|
||||
},
|
||||
}
|
||||
{
|
||||
'note': 'Audio + video (Dailymotion embed)',
|
||||
'url': 'https://www.franceinter.fr/emissions/l-instant-m/l-instant-m-13-fevrier-2018',
|
||||
'info_dict': {
|
||||
'id': 'x6eow0v',
|
||||
'ext': 'mp4',
|
||||
'title': 'Propagande, stéréotypes, spectaculaire : les jeux vidéo font-ils du mal à l\'Histoire ?',
|
||||
'description': 'Regardez Propagande, stéréotypes, spectaculaire : les jeux vidéo font-ils du mal à l\'Histoire ? par France Inter sur Dailymotion',
|
||||
'uploader_id': 'x2q2ez',
|
||||
'timestamp': 1518516881,
|
||||
'uploader': 'France Inter',
|
||||
'upload_date': '20180213',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
video_url = self._search_regex(
|
||||
# If there is a video version, use that instead
|
||||
maybe_video_uuid = re.search(r'data-video-anchor-target=["\']([^"\']+)', webpage)
|
||||
if maybe_video_uuid:
|
||||
video_uuid = maybe_video_uuid.group(1)
|
||||
video_url = self._search_regex(
|
||||
r'(?sx)data-uuid=["\']%s.*?<iframe[^>]*src=["\']([^"\']+)' % video_uuid,
|
||||
webpage, 'video url', fatal=False, group=1)
|
||||
|
||||
if video_url:
|
||||
return self.url_result(video_url)
|
||||
|
||||
audio_url = self._search_regex(
|
||||
r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
||||
webpage, 'video url', group='url')
|
||||
webpage, 'audio url', group='url')
|
||||
|
||||
title = self._og_search_title(webpage)
|
||||
description = self._og_search_description(webpage)
|
||||
@ -50,7 +79,7 @@ class FranceInterIE(InfoExtractor):
|
||||
'description': description,
|
||||
'upload_date': upload_date,
|
||||
'formats': [{
|
||||
'url': video_url,
|
||||
'url': audio_url,
|
||||
'vcodec': 'none',
|
||||
}],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user