mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-26 19:05:13 +00:00
refactor: remove dead aria2c and n_m3u8dl_re downloader code
The legacy aria2c, curl-impersonate, and N_m3u8DL-RE downloader backends were replaced by the unified in-process requests/rnet downloader. This strips the leftover references those removals missed.
This commit is contained in:
@@ -718,7 +718,6 @@ class dl:
|
|||||||
for name, binary in [
|
for name, binary in [
|
||||||
("shaka_packager", binaries.ShakaPackager),
|
("shaka_packager", binaries.ShakaPackager),
|
||||||
("mp4decrypt", binaries.Mp4decrypt),
|
("mp4decrypt", binaries.Mp4decrypt),
|
||||||
("n_m3u8dl_re", binaries.N_m3u8DL_RE),
|
|
||||||
("mkvmerge", binaries.MKVToolNix),
|
("mkvmerge", binaries.MKVToolNix),
|
||||||
("ffmpeg", binaries.FFMPEG),
|
("ffmpeg", binaries.FFMPEG),
|
||||||
("ffprobe", binaries.FFProbe),
|
("ffprobe", binaries.FFProbe),
|
||||||
@@ -744,11 +743,6 @@ class dl:
|
|||||||
output = (r.stdout or "") + (r.stderr or "")
|
output = (r.stdout or "") + (r.stderr or "")
|
||||||
lines = [line.strip() for line in output.split("\n") if line.strip()]
|
lines = [line.strip() for line in output.split("\n") if line.strip()]
|
||||||
version = " | ".join(lines[:2]) if lines else None
|
version = " | ".join(lines[:2]) if lines else None
|
||||||
elif name == "n_m3u8dl_re":
|
|
||||||
r = subprocess.run(
|
|
||||||
[str(binary), "--version"], capture_output=True, text=True, timeout=5
|
|
||||||
)
|
|
||||||
version = (r.stdout or r.stderr or "").strip().split("\n")[0]
|
|
||||||
except Exception:
|
except Exception:
|
||||||
version = "<error getting version>"
|
version = "<error getting version>"
|
||||||
binary_versions[name] = {"path": str(binary), "version": version}
|
binary_versions[name] = {"path": str(binary), "version": version}
|
||||||
|
|||||||
@@ -68,15 +68,6 @@ def check() -> None:
|
|||||||
"desc": "HDR10+ metadata",
|
"desc": "HDR10+ metadata",
|
||||||
"cat": "HDR",
|
"cat": "HDR",
|
||||||
},
|
},
|
||||||
# Downloaders
|
|
||||||
{"name": "aria2c", "binary": binaries.Aria2, "required": False, "desc": "Multi-thread DL", "cat": "Download"},
|
|
||||||
{
|
|
||||||
"name": "N_m3u8DL-RE",
|
|
||||||
"binary": binaries.N_m3u8DL_RE,
|
|
||||||
"required": False,
|
|
||||||
"desc": "HLS/DASH/ISM",
|
|
||||||
"cat": "Download",
|
|
||||||
},
|
|
||||||
# Subtitle Tools
|
# Subtitle Tools
|
||||||
{
|
{
|
||||||
"name": "SubtitleEdit",
|
"name": "SubtitleEdit",
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ def serialize_video_track(track: Video, include_url: bool = False) -> Dict[str,
|
|||||||
codec_name = track.codec.name if hasattr(track.codec, "name") else str(track.codec)
|
codec_name = track.codec.name if hasattr(track.codec, "name") else str(track.codec)
|
||||||
range_name = track.range.name if hasattr(track.range, "name") else str(track.range)
|
range_name = track.range.name if hasattr(track.range, "name") else str(track.range)
|
||||||
|
|
||||||
# Get descriptor for N_m3u8DL-RE compatibility (HLS, DASH, URL, etc.)
|
# Serialize the manifest descriptor (HLS, DASH, URL, etc.)
|
||||||
descriptor_name = None
|
descriptor_name = None
|
||||||
if hasattr(track, "descriptor") and track.descriptor:
|
if hasattr(track, "descriptor") and track.descriptor:
|
||||||
descriptor_name = track.descriptor.name if hasattr(track.descriptor, "name") else str(track.descriptor)
|
descriptor_name = track.descriptor.name if hasattr(track.descriptor, "name") else str(track.descriptor)
|
||||||
@@ -442,7 +442,7 @@ def serialize_audio_track(track: Audio, include_url: bool = False) -> Dict[str,
|
|||||||
"""Convert audio track to JSON-serializable dict."""
|
"""Convert audio track to JSON-serializable dict."""
|
||||||
codec_name = track.codec.name if hasattr(track.codec, "name") else str(track.codec)
|
codec_name = track.codec.name if hasattr(track.codec, "name") else str(track.codec)
|
||||||
|
|
||||||
# Get descriptor for N_m3u8DL-RE compatibility
|
# Serialize the manifest descriptor (HLS, DASH, URL, etc.)
|
||||||
descriptor_name = None
|
descriptor_name = None
|
||||||
if hasattr(track, "descriptor") and track.descriptor:
|
if hasattr(track, "descriptor") and track.descriptor:
|
||||||
descriptor_name = track.descriptor.name if hasattr(track.descriptor, "name") else str(track.descriptor)
|
descriptor_name = track.descriptor.name if hasattr(track.descriptor, "name") else str(track.descriptor)
|
||||||
|
|||||||
@@ -45,12 +45,10 @@ ShakaPackager = find(
|
|||||||
f"packager-{__shaka_platform}-arm64",
|
f"packager-{__shaka_platform}-arm64",
|
||||||
f"packager-{__shaka_platform}-x64",
|
f"packager-{__shaka_platform}-x64",
|
||||||
)
|
)
|
||||||
Aria2 = find("aria2c", "aria2")
|
|
||||||
CCExtractor = find("ccextractor", "ccextractorwin", "ccextractorwinfull")
|
CCExtractor = find("ccextractor", "ccextractorwin", "ccextractorwinfull")
|
||||||
HolaProxy = find("hola-proxy")
|
HolaProxy = find("hola-proxy")
|
||||||
MPV = find("mpv")
|
MPV = find("mpv")
|
||||||
Caddy = find("caddy")
|
Caddy = find("caddy")
|
||||||
N_m3u8DL_RE = find("N_m3u8DL-RE", "n-m3u8dl-re")
|
|
||||||
MKVToolNix = find("mkvmerge")
|
MKVToolNix = find("mkvmerge")
|
||||||
Mkvpropedit = find("mkvpropedit")
|
Mkvpropedit = find("mkvpropedit")
|
||||||
DoviTool = find("dovi_tool")
|
DoviTool = find("dovi_tool")
|
||||||
@@ -66,12 +64,10 @@ __all__ = (
|
|||||||
"FFPlay",
|
"FFPlay",
|
||||||
"SubtitleEdit",
|
"SubtitleEdit",
|
||||||
"ShakaPackager",
|
"ShakaPackager",
|
||||||
"Aria2",
|
|
||||||
"CCExtractor",
|
"CCExtractor",
|
||||||
"HolaProxy",
|
"HolaProxy",
|
||||||
"MPV",
|
"MPV",
|
||||||
"Caddy",
|
"Caddy",
|
||||||
"N_m3u8DL_RE",
|
|
||||||
"MKVToolNix",
|
"MKVToolNix",
|
||||||
"Mkvpropedit",
|
"Mkvpropedit",
|
||||||
"DoviTool",
|
"DoviTool",
|
||||||
|
|||||||
@@ -490,39 +490,6 @@ class HLS:
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _finalize_n_m3u8dl_re_output(*, track: AnyTrack, save_dir: Path, save_path: Path) -> Path:
|
|
||||||
"""
|
|
||||||
Finalize output from N_m3u8DL-RE.
|
|
||||||
|
|
||||||
We call N_m3u8DL-RE with `--save-name track.id`, so the final file should be `{track.id}.*` under `save_dir`.
|
|
||||||
This moves that output to `save_path` (preserving the real suffix) and, for subtitles, updates `track.codec`
|
|
||||||
to match the produced file extension.
|
|
||||||
"""
|
|
||||||
matches = [p for p in save_dir.rglob(f"{track.id}.*") if p.is_file()]
|
|
||||||
if not matches:
|
|
||||||
raise FileNotFoundError(f"No output files produced by N_m3u8DL-RE for save-name={track.id} in: {save_dir}")
|
|
||||||
|
|
||||||
primary = max(matches, key=lambda p: p.stat().st_size)
|
|
||||||
|
|
||||||
final_save_path = save_path.with_suffix(primary.suffix) if primary.suffix else save_path
|
|
||||||
|
|
||||||
final_save_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if primary.absolute() != final_save_path.absolute():
|
|
||||||
final_save_path.unlink(missing_ok=True)
|
|
||||||
shutil.move(str(primary), str(final_save_path))
|
|
||||||
|
|
||||||
if isinstance(track, Subtitle):
|
|
||||||
ext = final_save_path.suffix.lower().lstrip(".")
|
|
||||||
try:
|
|
||||||
track.codec = Subtitle.Codec.from_mime(ext)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
shutil.rmtree(save_dir, ignore_errors=True)
|
|
||||||
|
|
||||||
return final_save_path
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download_track(
|
def download_track(
|
||||||
track: AnyTrack,
|
track: AnyTrack,
|
||||||
|
|||||||
@@ -395,29 +395,13 @@ key_vaults:
|
|||||||
# no_push: false # Default behavior - vault both provides and receives keys
|
# no_push: false # Default behavior - vault both provides and receives keys
|
||||||
|
|
||||||
# Choose what software to use to download data
|
# Choose what software to use to download data
|
||||||
downloader: aria2c
|
downloader: requests
|
||||||
# Options: requests | aria2c | curl_impersonate | n_m3u8dl_re
|
# Options: requests
|
||||||
# Can also be a mapping:
|
# Downloading now uses the unified in-process requests/rnet downloader; the legacy
|
||||||
# downloader:
|
# aria2c, curl_impersonate, and n_m3u8dl_re backends have been removed.
|
||||||
# NF: requests
|
|
||||||
# AMZN: n_m3u8dl_re
|
|
||||||
# DSNP: n_m3u8dl_re
|
|
||||||
# default: requests
|
|
||||||
|
|
||||||
# aria2c downloader configuration
|
# rnet TLS impersonation preset (not a downloader). Selects the browser
|
||||||
aria2c:
|
# fingerprint the HTTP session impersonates.
|
||||||
max_concurrent_downloads: 4
|
|
||||||
max_connection_per_server: 3
|
|
||||||
split: 5
|
|
||||||
file_allocation: falloc # none | prealloc | falloc | trunc
|
|
||||||
|
|
||||||
# N_m3u8DL-RE downloader configuration
|
|
||||||
n_m3u8dl_re:
|
|
||||||
thread_count: 16
|
|
||||||
ad_keyword: "advertisement"
|
|
||||||
use_proxy: true
|
|
||||||
|
|
||||||
# curl_impersonate downloader configuration
|
|
||||||
curl_impersonate:
|
curl_impersonate:
|
||||||
browser: chrome120
|
browser: chrome120
|
||||||
|
|
||||||
@@ -555,9 +539,8 @@ remote_services:
|
|||||||
# Per-service overrides for remote services
|
# Per-service overrides for remote services
|
||||||
# Override downloader, decryption tool, or CDM settings per service on the client
|
# Override downloader, decryption tool, or CDM settings per service on the client
|
||||||
services:
|
services:
|
||||||
# Example: Use n_m3u8dl_re for HLS services, mp4decrypt for specific services
|
# Example: Override the decryption tool for specific services
|
||||||
# EXAMPLE_SERVICE:
|
# EXAMPLE_SERVICE:
|
||||||
# downloader: n_m3u8dl_re # Override client downloader (requests, aria2c, n_m3u8dl_re, curl_impersonate)
|
|
||||||
# decryption: mp4decrypt # Override decryption tool (shaka, mp4decrypt)
|
# decryption: mp4decrypt # Override decryption tool (shaka, mp4decrypt)
|
||||||
|
|
||||||
# Example: Multiple servers
|
# Example: Multiple servers
|
||||||
@@ -567,7 +550,6 @@ remote_services:
|
|||||||
# server_cdm: true
|
# server_cdm: true
|
||||||
# services:
|
# services:
|
||||||
# EXAMPLE:
|
# EXAMPLE:
|
||||||
# downloader: n_m3u8dl_re
|
|
||||||
# decryption: mp4decrypt
|
# decryption: mp4decrypt
|
||||||
# eu-server:
|
# eu-server:
|
||||||
# url: "https://eu.example.com:8786"
|
# url: "https://eu.example.com:8786"
|
||||||
@@ -581,7 +563,7 @@ services:
|
|||||||
|
|
||||||
# You can override ANY global configuration option on a per-service basis
|
# You can override ANY global configuration option on a per-service basis
|
||||||
# This allows fine-tuned control for services with special requirements
|
# This allows fine-tuned control for services with special requirements
|
||||||
# Supported overrides: dl, aria2c, n_m3u8dl_re, curl_impersonate, subtitle, muxing, headers, etc.
|
# Supported overrides: dl, curl_impersonate, subtitle, muxing, headers, etc.
|
||||||
|
|
||||||
# Example: Comprehensive service configuration showing all features
|
# Example: Comprehensive service configuration showing all features
|
||||||
EXAMPLE:
|
EXAMPLE:
|
||||||
@@ -627,20 +609,6 @@ services:
|
|||||||
lang: ["en", "es-419"] # Different language priority for this service
|
lang: ["en", "es-419"] # Different language priority for this service
|
||||||
sub_format: srt # Force SRT subtitle format
|
sub_format: srt # Force SRT subtitle format
|
||||||
|
|
||||||
# Override n_m3u8dl_re downloader settings
|
|
||||||
n_m3u8dl_re:
|
|
||||||
thread_count: 8 # Lower thread count for rate-limited service (global default: 16)
|
|
||||||
use_proxy: true # Force proxy usage for this service
|
|
||||||
retry_count: 10 # More retries for unstable connections
|
|
||||||
ad_keyword: "advertisement" # Service-specific ad filtering
|
|
||||||
|
|
||||||
# Override aria2c downloader settings
|
|
||||||
aria2c:
|
|
||||||
max_concurrent_downloads: 2 # Limit concurrent downloads (global default: 4)
|
|
||||||
max_connection_per_server: 1 # Single connection per server
|
|
||||||
split: 3 # Fewer splits (global default: 5)
|
|
||||||
file_allocation: none # Faster allocation for this service
|
|
||||||
|
|
||||||
# Override subtitle processing for this service
|
# Override subtitle processing for this service
|
||||||
subtitle:
|
subtitle:
|
||||||
conversion_method: pycaption # Use specific subtitle converter
|
conversion_method: pycaption # Use specific subtitle converter
|
||||||
@@ -675,18 +643,12 @@ services:
|
|||||||
dl:
|
dl:
|
||||||
downloads: 2 # Limit concurrent downloads
|
downloads: 2 # Limit concurrent downloads
|
||||||
workers: 4 # Reduce workers to avoid rate limits
|
workers: 4 # Reduce workers to avoid rate limits
|
||||||
n_m3u8dl_re:
|
|
||||||
thread_count: 4 # Very low thread count
|
|
||||||
retry_count: 20 # More retries for flaky service
|
|
||||||
aria2c:
|
|
||||||
max_concurrent_downloads: 1 # Download tracks one at a time
|
|
||||||
max_connection_per_server: 1 # Single connection only
|
|
||||||
|
|
||||||
# Notes on service-specific overrides:
|
# Notes on service-specific overrides:
|
||||||
# - Overrides are merged with global config, not replaced
|
# - Overrides are merged with global config, not replaced
|
||||||
# - Only specified keys are overridden, others use global defaults
|
# - Only specified keys are overridden, others use global defaults
|
||||||
# - Reserved keys (profiles, api_key, certificate, etc.) are NOT treated as overrides
|
# - Reserved keys (profiles, api_key, certificate, etc.) are NOT treated as overrides
|
||||||
# - Any dict-type config option can be overridden (dl, aria2c, n_m3u8dl_re, subtitle, etc.)
|
# - Any dict-type config option can be overridden (dl, subtitle, muxing, headers, etc.)
|
||||||
# - CLI arguments always take priority over service-specific config
|
# - CLI arguments always take priority over service-specific config
|
||||||
|
|
||||||
# External proxy provider services
|
# External proxy provider services
|
||||||
|
|||||||
Reference in New Issue
Block a user