mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[ie/ondemandkorea] Fix upgraded format extraction (#8677)
Closes #8675 Authored by: seproDev
This commit is contained in:
parent
b03c89309e
commit
04a5e06350
1 changed files with 9 additions and 8 deletions
|
@ -3,7 +3,6 @@
|
|||
import uuid
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..networking import HEADRequest
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
OnDemandPagedList,
|
||||
|
@ -84,15 +83,17 @@ def _real_extract(self, url):
|
|||
def try_geo_bypass(url):
|
||||
return traverse_obj(url, ({parse_qs}, 'stream_url', 0, {url_or_none})) or url
|
||||
|
||||
def try_upgrade_quality(url):
|
||||
mod_url = re.sub(r'_720(p?)\.m3u8', r'_1080\1.m3u8', url)
|
||||
return mod_url if mod_url != url and self._request_webpage(
|
||||
HEADRequest(mod_url), video_id, note='Checking for higher quality format',
|
||||
errnote='No higher quality format found', fatal=False) else url
|
||||
|
||||
formats = []
|
||||
for m3u8_url in traverse_obj(data, (('sources', 'manifest'), ..., 'url', {url_or_none}, {try_geo_bypass})):
|
||||
formats.extend(self._extract_m3u8_formats(try_upgrade_quality(m3u8_url), video_id, fatal=False))
|
||||
mod_url = re.sub(r'_720(p?)\.m3u8', r'_1080\1.m3u8', m3u8_url)
|
||||
if mod_url != m3u8_url:
|
||||
mod_format = self._extract_m3u8_formats(
|
||||
mod_url, video_id, note='Checking for higher quality format',
|
||||
errnote='No higher quality format found', fatal=False)
|
||||
if mod_format:
|
||||
formats.extend(mod_format)
|
||||
continue
|
||||
formats.extend(self._extract_m3u8_formats(m3u8_url, video_id, fatal=False))
|
||||
|
||||
subtitles = {}
|
||||
for track in traverse_obj(data, ('text_tracks', lambda _, v: url_or_none(v['url']))):
|
||||
|
|
Loading…
Reference in a new issue