From 274b2fc3083e68f7675b2dd11590484a362ab79c Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Wed, 12 Aug 2026 11:42:15 -0600 Subject: [PATCH] fix(subtitle): keep cue-less webvtt instead of failing the download A rendition with headers but no cues raised CaptionReadNoCaptions when preserve_formatting is false, aborting the whole download. --- unshackle/core/tracks/subtitle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unshackle/core/tracks/subtitle.py b/unshackle/core/tracks/subtitle.py index b95847c8..33e14236 100644 --- a/unshackle/core/tracks/subtitle.py +++ b/unshackle/core/tracks/subtitle.py @@ -291,6 +291,9 @@ class Subtitle(Track): Subtitle.filter_unwanted_cues(caption_set) subtitle_text = pycaption.WebVTTWriter().write(caption_set) self.path.write_text(subtitle_text, encoding="utf8") + except pycaption.exceptions.CaptionReadNoCaptions: + # some renditions carry headers but no cues; write them out rather than fail the download + self.path.write_text(text, encoding="utf8") except pycaption.exceptions.CaptionReadSyntaxError: # If first attempt fails, try more aggressive sanitization text = Subtitle.sanitize_webvtt(text)