[abc:iview] apply more suggestions

This commit is contained in:
ClosedPort22 2024-06-28 09:21:53 +08:00
parent ad98e612dc
commit d1789d4a8b
No known key found for this signature in database

View File

@ -334,10 +334,9 @@ def tokenize_url(url, token):
# Note: pre-merged formats in hls-latest are treated as video-only if audio-only tracks
# are present, so we extract both types
for label in ('hls', 'hls-latest'):
for sd_url in traverse_obj(stream, ('streams', label, ('1080', '720', 'sd', 'sd-low'), {str})):
for sd_url in traverse_obj(stream, ('streams', label, ('1080', '720', 'sd', 'sd-low'), {url_or_none})):
fmts = self._extract_m3u8_formats(
tokenize_url(sd_url, token), video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=label, fatal=False)
tokenize_url(sd_url, token), video_id, 'mp4', m3u8_id=label, fatal=False)
if fmts:
formats.extend(fmts)
break
@ -349,7 +348,7 @@ def tokenize_url(url, token):
'ext': 'vtt',
}]
title = unescapeHTML(traverse_obj(video_params, 'title', 'seriesTitle', 'showTitle'))
title = traverse_obj(video_params, 'title', 'seriesTitle', 'showTitle', expected_type=unescapeHTML)
return {
'id': video_id,