mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 14:41:44 +00:00
[ie/ondemandkorea] Fix upgraded format extraction (#8677)
Closes #8675 Authored by: seproDev
This commit is contained in:
parent
b03c89309e
commit
04a5e06350
@ -3,7 +3,6 @@ import re
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..networking import HEADRequest
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
OnDemandPagedList,
|
OnDemandPagedList,
|
||||||
@ -84,15 +83,17 @@ class OnDemandKoreaIE(InfoExtractor):
|
|||||||
def try_geo_bypass(url):
|
def try_geo_bypass(url):
|
||||||
return traverse_obj(url, ({parse_qs}, 'stream_url', 0, {url_or_none})) or 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 = []
|
formats = []
|
||||||
for m3u8_url in traverse_obj(data, (('sources', 'manifest'), ..., 'url', {url_or_none}, {try_geo_bypass})):
|
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 = {}
|
subtitles = {}
|
||||||
for track in traverse_obj(data, ('text_tracks', lambda _, v: url_or_none(v['url']))):
|
for track in traverse_obj(data, ('text_tracks', lambda _, v: url_or_none(v['url']))):
|
||||||
|
Loading…
Reference in New Issue
Block a user