Compare commits

..

2 Commits

Author SHA1 Message Date
c-basalt
836e057abb
Update yt_dlp/extractor/douyutv.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-09-19 17:07:02 -04:00
c-basalt
2d5718af30
Update yt_dlp/extractor/douyutv.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-09-19 17:02:48 -04:00

View File

@ -139,10 +139,12 @@ class DouyuTVIE(DouyuBaseIE):
if stream_url:
rate_id = traverse_obj(stream_info, ('rate', {int_or_none}))
rate_info = traverse_obj(stream_info, ('multirates', lambda _, v: v['rate'] == rate_id), get_all=False)
ext = determine_ext(stream_url)
formats.append({
'url': stream_url,
'format_id': str_or_none(rate_id),
'ext': 'mp4' if '.m3u8' in stream_url else determine_ext(stream_url),
'ext': 'mp4' if ext == 'm3u8' else ext,
'protocol': 'm3u8_native' if ext == 'm3u8' else 'https',
'quality': rate_id % -10000 if rate_id is not None else None,
**traverse_obj(rate_info, {
'format': ('name', {str_or_none}),
@ -274,12 +276,14 @@ class DouyuShowIE(DouyuBaseIE):
for name, url in traverse_obj(url_info, ('data', 'thumb_video', {dict.items}, ...)):
video_url = traverse_obj(url, ('url', {url_or_none}))
if video_url:
ext = determine_ext(video_url)
formats.append({
'format': self._FORMATS.get(name),
'format_id': name,
'url': video_url,
'quality': self._QUALITIES.get(name),
'ext': 'mp4' if '.m3u8' in video_url else determine_ext(video_url),
'ext': 'mp4' if ext == 'm3u8' else ext,
'protocol': 'm3u8_native' if ext == 'm3u8' else 'https',
**parse_resolution(self._RESOLUTIONS.get(name))
})
else: