mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[ie/ertgr] Fix video extraction (#11091)
Closes #8955 Authored by: seproDev
This commit is contained in:
parent
b37417e4f9
commit
416686ed0c
@ -17,6 +17,7 @@
|
|||||||
url_or_none,
|
url_or_none,
|
||||||
variadic,
|
variadic,
|
||||||
)
|
)
|
||||||
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class ERTFlixBaseIE(InfoExtractor):
|
class ERTFlixBaseIE(InfoExtractor):
|
||||||
@ -74,29 +75,28 @@ class ERTFlixCodenameIE(ERTFlixBaseIE):
|
|||||||
|
|
||||||
def _extract_formats_and_subs(self, video_id):
|
def _extract_formats_and_subs(self, video_id):
|
||||||
media_info = self._call_api(video_id, codename=video_id)
|
media_info = self._call_api(video_id, codename=video_id)
|
||||||
formats, subs = [], {}
|
formats, subtitles = [], {}
|
||||||
for media_file in try_get(media_info, lambda x: x['MediaFiles'], list) or []:
|
for media in traverse_obj(media_info, (
|
||||||
for media in try_get(media_file, lambda x: x['Formats'], list) or []:
|
'MediaFiles', lambda _, v: v['RoleCodename'] == 'main',
|
||||||
fmt_url = url_or_none(try_get(media, lambda x: x['Url']))
|
'Formats', lambda _, v: url_or_none(v['Url']))):
|
||||||
if not fmt_url:
|
fmt_url = media['Url']
|
||||||
continue
|
ext = determine_ext(fmt_url)
|
||||||
ext = determine_ext(fmt_url)
|
if ext == 'm3u8':
|
||||||
if ext == 'm3u8':
|
fmts, subs = self._extract_m3u8_formats_and_subtitles(
|
||||||
formats_, subs_ = self._extract_m3u8_formats_and_subtitles(
|
fmt_url, video_id, m3u8_id='hls', ext='mp4', fatal=False)
|
||||||
fmt_url, video_id, m3u8_id='hls', ext='mp4', fatal=False)
|
elif ext == 'mpd':
|
||||||
elif ext == 'mpd':
|
fmts, subs = self._extract_mpd_formats_and_subtitles(
|
||||||
formats_, subs_ = self._extract_mpd_formats_and_subtitles(
|
fmt_url, video_id, mpd_id='dash', fatal=False)
|
||||||
fmt_url, video_id, mpd_id='dash', fatal=False)
|
else:
|
||||||
else:
|
formats.append({
|
||||||
formats.append({
|
'url': fmt_url,
|
||||||
'url': fmt_url,
|
'format_id': str_or_none(media.get('Id')),
|
||||||
'format_id': str_or_none(media.get('Id')),
|
})
|
||||||
})
|
continue
|
||||||
continue
|
formats.extend(fmts)
|
||||||
formats.extend(formats_)
|
self._merge_subtitles(subs, target=subtitles)
|
||||||
self._merge_subtitles(subs_, target=subs)
|
|
||||||
|
|
||||||
return formats, subs
|
return formats, subtitles
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user