fix(track): fallback to requests downloader from n_m3u8dl_re for unsupported track types

This commit is contained in:
Andy
2026-02-24 12:57:46 -07:00
parent b11b23e529
commit 34f4d6bff7
2 changed files with 7 additions and 23 deletions

View File

@@ -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:

View File

@@ -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,21 +210,10 @@ 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",
}
or track_type in ("Subtitle", "Attachment")
):
self.downloader = requests