mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-03-10 16:39:01 +00:00
fix(track): fallback to requests downloader from n_m3u8dl_re for unsupported track types
This commit is contained in:
@@ -1861,11 +1861,6 @@ class dl:
|
|||||||
)
|
)
|
||||||
self.cdm = quality_based_cdm
|
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()
|
dl_start_time = time.time()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -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.downloaders import aria2c, curl_impersonate, n_m3u8dl_re, requests
|
||||||
from unshackle.core.drm import DRM_T, PlayReady, Widevine
|
from unshackle.core.drm import DRM_T, PlayReady, Widevine
|
||||||
from unshackle.core.events import events
|
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
|
from unshackle.core.utils.subprocess import ffprobe
|
||||||
|
|
||||||
|
|
||||||
@@ -210,21 +210,10 @@ class Track:
|
|||||||
save_path = config.directories.temp / f"{track_type}_{self.id}.mp4"
|
save_path = config.directories.temp / f"{track_type}_{self.id}.mp4"
|
||||||
if track_type == "Subtitle":
|
if track_type == "Subtitle":
|
||||||
save_path = save_path.with_suffix(f".{self.codec.extension}")
|
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 (
|
if self.downloader.__name__ == "n_m3u8dl_re" and (
|
||||||
self.descriptor == self.Descriptor.URL
|
self.descriptor == self.Descriptor.URL
|
||||||
or get_extension(self.url)
|
or track_type in ("Subtitle", "Attachment")
|
||||||
in {
|
|
||||||
".srt",
|
|
||||||
".vtt",
|
|
||||||
".ttml",
|
|
||||||
".ssa",
|
|
||||||
".ass",
|
|
||||||
".stpp",
|
|
||||||
".wvtt",
|
|
||||||
".xml",
|
|
||||||
}
|
|
||||||
):
|
):
|
||||||
self.downloader = requests
|
self.downloader = requests
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user