mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
11 years ago
|
# coding: utf-8
|
||
11 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
11 years ago
|
import re
|
||
|
|
||
|
from .common import InfoExtractor
|
||
|
|
||
|
|
||
|
class RadioFranceIE(InfoExtractor):
|
||
|
_VALID_URL = r'^https?://maison\.radiofrance\.fr/radiovisions/(?P<id>[^?#]+)'
|
||
11 years ago
|
IE_NAME = 'radiofrance'
|
||
11 years ago
|
|
||
|
_TEST = {
|
||
11 years ago
|
'url': 'http://maison.radiofrance.fr/radiovisions/one-one',
|
||
|
'md5': 'bdbb28ace95ed0e04faab32ba3160daf',
|
||
|
'info_dict': {
|
||
|
'id': 'one-one',
|
||
|
'ext': 'ogg',
|
||
9 years ago
|
'title': 'One to one',
|
||
|
'description': "Plutôt que d'imaginer la radio de demain comme technologie ou comme création de contenu, je veux montrer que quelles que soient ses évolutions, j'ai l'intime conviction que la radio continuera d'être un grand média de proximité pour les auditeurs.",
|
||
|
'uploader': 'Thomas Hercouët',
|
||
11 years ago
|
},
|
||
|
}
|
||
|
|
||
|
def _real_extract(self, url):
|
||
|
m = re.match(self._VALID_URL, url)
|
||
|
video_id = m.group('id')
|
||
|
|
||
|
webpage = self._download_webpage(url, video_id)
|
||
11 years ago
|
title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
|
||
11 years ago
|
description = self._html_search_regex(
|
||
|
r'<div class="bloc_page_wrapper"><div class="text">(.*?)</div>',
|
||
11 years ago
|
webpage, 'description', fatal=False)
|
||
11 years ago
|
uploader = self._html_search_regex(
|
||
|
r'<div class="credit"> © (.*?)</div>',
|
||
11 years ago
|
webpage, 'uploader', fatal=False)
|
||
11 years ago
|
|
||
|
formats_str = self._html_search_regex(
|
||
|
r'class="jp-jplayer[^"]*" data-source="([^"]+)">',
|
||
11 years ago
|
webpage, 'audio URLs')
|
||
11 years ago
|
formats = [
|
||
|
{
|
||
11 years ago
|
'format_id': fm[0],
|
||
|
'url': fm[1],
|
||
11 years ago
|
'vcodec': 'none',
|
||
4 years ago
|
'quality': i,
|
||
11 years ago
|
}
|
||
11 years ago
|
for i, fm in
|
||
|
enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str))
|
||
11 years ago
|
]
|
||
11 years ago
|
self._sort_formats(formats)
|
||
11 years ago
|
|
||
|
return {
|
||
|
'id': video_id,
|
||
|
'title': title,
|
||
|
'formats': formats,
|
||
|
'description': description,
|
||
|
'uploader': uploader,
|
||
|
}
|