mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[rutv] Fix preference
This commit is contained in:
parent
dfad3aac98
commit
e038d5c4e3
1 changed files with 7 additions and 5 deletions
|
@ -128,8 +128,10 @@ def _real_extract(self, url):
|
||||||
elif video_path.startswith('index/iframe/cast_id'):
|
elif video_path.startswith('index/iframe/cast_id'):
|
||||||
video_type = 'live'
|
video_type = 'live'
|
||||||
|
|
||||||
|
is_live = video_type == 'live'
|
||||||
|
|
||||||
json_data = self._download_json(
|
json_data = self._download_json(
|
||||||
'http://player.rutv.ru/iframe/%splay/id/%s' % ('live-' if video_type == 'live' else '', video_id),
|
'http://player.rutv.ru/iframe/%splay/id/%s' % ('live-' if is_live else '', video_id),
|
||||||
video_id, 'Downloading JSON')
|
video_id, 'Downloading JSON')
|
||||||
|
|
||||||
if json_data['errors']:
|
if json_data['errors']:
|
||||||
|
@ -156,6 +158,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
for transport, links in media['sources'].items():
|
for transport, links in media['sources'].items():
|
||||||
for quality, url in links.items():
|
for quality, url in links.items():
|
||||||
|
preference = -1 if priority_transport == transport else -2
|
||||||
if transport == 'rtmp':
|
if transport == 'rtmp':
|
||||||
mobj = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>.+)$', url)
|
mobj = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>.+)$', url)
|
||||||
if not mobj:
|
if not mobj:
|
||||||
|
@ -169,9 +172,11 @@ def _real_extract(self, url):
|
||||||
'rtmp_live': True,
|
'rtmp_live': True,
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'vbr': int(quality),
|
'vbr': int(quality),
|
||||||
|
'preference': preference,
|
||||||
}
|
}
|
||||||
elif transport == 'm3u8':
|
elif transport == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(url, video_id, 'mp4'))
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
url, video_id, 'mp4', preference=preference, m3u8_id='hls'))
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
fmt = {
|
fmt = {
|
||||||
|
@ -181,7 +186,6 @@ def _real_extract(self, url):
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height,
|
'height': height,
|
||||||
'format_id': '%s-%s' % (transport, quality),
|
'format_id': '%s-%s' % (transport, quality),
|
||||||
'preference': -1 if priority_transport == transport else -2,
|
|
||||||
})
|
})
|
||||||
formats.append(fmt)
|
formats.append(fmt)
|
||||||
|
|
||||||
|
@ -190,8 +194,6 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
is_live = video_type == 'live'
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': self._live_title(title) if is_live else title,
|
||||||
|
|
Loading…
Reference in a new issue