From 34f4d6bff732fcb2297c73f2816c19edd83df9b9 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 24 Feb 2026 12:57:46 -0700 Subject: [PATCH] fix(track): fallback to requests downloader from n_m3u8dl_re for unsupported track types --- unshackle/commands/dl.py | 5 ----- unshackle/core/tracks/track.py | 25 +++++++------------------ 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/unshackle/commands/dl.py b/unshackle/commands/dl.py index 4328228..ec592b6 100644 --- a/unshackle/commands/dl.py +++ b/unshackle/commands/dl.py @@ -1861,11 +1861,6 @@ class dl: ) self.cdm = quality_based_cdm - for track in title.tracks.subtitles: - if callable(track.OnSegmentFilter) and track.downloader.__name__ == "n_m3u8dl_re": - from unshackle.core.downloaders import requests as requests_downloader - track.downloader = requests_downloader - dl_start_time = time.time() try: diff --git a/unshackle/core/tracks/track.py b/unshackle/core/tracks/track.py index b9e3720..a6beb7f 100644 --- a/unshackle/core/tracks/track.py +++ b/unshackle/core/tracks/track.py @@ -24,7 +24,7 @@ from unshackle.core.constants import DOWNLOAD_CANCELLED, DOWNLOAD_LICENCE_ONLY from unshackle.core.downloaders import aria2c, curl_impersonate, n_m3u8dl_re, requests from unshackle.core.drm import DRM_T, PlayReady, Widevine from unshackle.core.events import events -from unshackle.core.utilities import get_boxes, get_extension, try_ensure_utf8 +from unshackle.core.utilities import get_boxes, try_ensure_utf8 from unshackle.core.utils.subprocess import ffprobe @@ -210,23 +210,12 @@ class Track: save_path = config.directories.temp / f"{track_type}_{self.id}.mp4" if track_type == "Subtitle": save_path = save_path.with_suffix(f".{self.codec.extension}") - # n_m3u8dl_re doesn't support directly downloading subtitles from URLs - # or when the subtitle has a direct file extension - if self.downloader.__name__ == "n_m3u8dl_re" and ( - self.descriptor == self.Descriptor.URL - or get_extension(self.url) - in { - ".srt", - ".vtt", - ".ttml", - ".ssa", - ".ass", - ".stpp", - ".wvtt", - ".xml", - } - ): - self.downloader = requests + + if self.downloader.__name__ == "n_m3u8dl_re" and ( + self.descriptor == self.Descriptor.URL + or track_type in ("Subtitle", "Attachment") + ): + self.downloader = requests if self.descriptor != self.Descriptor.URL: save_dir = save_path.with_name(save_path.name + "_segments")