1
0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2024-11-24 08:27:29 +00:00

change order of checks to fix KeyError bug with ytdlp 2023.6

This commit is contained in:
Cadence Ember 2023-07-01 23:48:38 +12:00
parent f53dd28ada
commit 28511bdf96

View File

@ -109,16 +109,16 @@ def extract_video(id):
# return result
for format in info["formats"]:
# m3u8 playlists cannot be played.
if "m3u8" in format["protocol"]:
continue
# Storyboard images are now included in formats, we don't want them.
# Storyboards have neither audio nor video, so detect them that way.
# They could also be detected with ("storyboard" in format_note), or with (protocol == "mhtml").
if format["acodec"] == "none" and format["vcodec"] == "none":
continue
# m3u8 playlists cannot be played.
if "m3u8" in format["protocol"]:
continue
# Adaptive formats have either audio or video, format streams have both, storyboard images have neither.
is_adaptive = format["acodec"] == "none" or format["vcodec"] == "none"
sense = "video" if format["vcodec"] != "none" else "audio"