Upgrade yt_dlp and download script
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import re
|
||||
|
||||
from .srgssr import SRGSSRIE
|
||||
from ..compat import compat_str
|
||||
from ..utils import (
|
||||
determine_ext,
|
||||
int_or_none,
|
||||
@@ -13,6 +12,7 @@ from ..utils import (
|
||||
|
||||
|
||||
class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
_WORKING = False
|
||||
IE_DESC = 'RTS.ch'
|
||||
_VALID_URL = r'rts:(?P<rts_id>\d+)|https?://(?:.+?\.)?rts\.ch/(?:[^/]+/){2,}(?P<id>[0-9]+)-(?P<display_id>.+?)\.html'
|
||||
|
||||
@@ -109,7 +109,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
{
|
||||
'url': 'http://pages.rts.ch/emissions/passe-moi-les-jumelles/5624065-entre-ciel-et-mer.html',
|
||||
'only_matching': True,
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
def _real_extract(self, url):
|
||||
@@ -119,7 +119,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
|
||||
def download_json(internal_id):
|
||||
return self._download_json(
|
||||
'http://www.rts.ch/a/%s.html?f=json/article' % internal_id,
|
||||
f'http://www.rts.ch/a/{internal_id}.html?f=json/article',
|
||||
display_id)
|
||||
|
||||
all_info = download_json(media_id)
|
||||
@@ -148,7 +148,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
r'(?s)<iframe[^>]+class="srg-player"[^>]+src="[^"]+urn:([^"]+)"',
|
||||
page)
|
||||
if videos:
|
||||
entries = [self.url_result('srgssr:%s' % video_urn, 'SRGSSR') for video_urn in videos]
|
||||
entries = [self.url_result(f'srgssr:{video_urn}', 'SRGSSR') for video_urn in videos]
|
||||
|
||||
if entries:
|
||||
return self.playlist_result(entries, media_id, all_info.get('title'))
|
||||
@@ -195,7 +195,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
'tbr': extract_bitrate(format_url),
|
||||
})
|
||||
|
||||
download_base = 'http://rtsww%s-d.rts.ch/' % ('-a' if media_type == 'audio' else '')
|
||||
download_base = 'http://rtsww{}-d.rts.ch/'.format('-a' if media_type == 'audio' else '')
|
||||
for media in info.get('media', []):
|
||||
media_url = media.get('url')
|
||||
if not media_url or re.match(r'https?://', media_url):
|
||||
@@ -214,7 +214,7 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE
|
||||
self._check_formats(formats, media_id)
|
||||
|
||||
duration = info.get('duration') or info.get('cutout') or info.get('cutduration')
|
||||
if isinstance(duration, compat_str):
|
||||
if isinstance(duration, str):
|
||||
duration = parse_duration(duration)
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user