mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-04 22:30:23 +00:00
f983b87567
'preference' is to be used only when the format is better that ALL qualities of a lower preference irrespective of ANY sorting order the user requests. See deezer.py for correct use of this In the older sorting method, `preference`, `quality` and `language_preference` were functionally almost equivalent. So these disparities doesn't really matter there Also, despite what the documentation says, the default for `preference` was actually 0 and not -1. I have tried to correct this and also account for it when converting `preference` to `quality`
60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
# coding: utf-8
|
|
from __future__ import unicode_literals
|
|
|
|
import re
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
class RadioFranceIE(InfoExtractor):
|
|
_VALID_URL = r'^https?://maison\.radiofrance\.fr/radiovisions/(?P<id>[^?#]+)'
|
|
IE_NAME = 'radiofrance'
|
|
|
|
_TEST = {
|
|
'url': 'http://maison.radiofrance.fr/radiovisions/one-one',
|
|
'md5': 'bdbb28ace95ed0e04faab32ba3160daf',
|
|
'info_dict': {
|
|
'id': 'one-one',
|
|
'ext': 'ogg',
|
|
'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',
|
|
},
|
|
}
|
|
|
|
def _real_extract(self, url):
|
|
m = re.match(self._VALID_URL, url)
|
|
video_id = m.group('id')
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
|
|
description = self._html_search_regex(
|
|
r'<div class="bloc_page_wrapper"><div class="text">(.*?)</div>',
|
|
webpage, 'description', fatal=False)
|
|
uploader = self._html_search_regex(
|
|
r'<div class="credit"> © (.*?)</div>',
|
|
webpage, 'uploader', fatal=False)
|
|
|
|
formats_str = self._html_search_regex(
|
|
r'class="jp-jplayer[^"]*" data-source="([^"]+)">',
|
|
webpage, 'audio URLs')
|
|
formats = [
|
|
{
|
|
'format_id': fm[0],
|
|
'url': fm[1],
|
|
'vcodec': 'none',
|
|
'quality': i,
|
|
}
|
|
for i, fm in
|
|
enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str))
|
|
]
|
|
self._sort_formats(formats)
|
|
|
|
return {
|
|
'id': video_id,
|
|
'title': title,
|
|
'formats': formats,
|
|
'description': description,
|
|
'uploader': uploader,
|
|
}
|