Fix n_m3u8dl_re

This commit is contained in:
CodeName393
2026-01-22 15:28:24 +09:00
committed by GitHub
parent f3cc1d080e
commit 3c049a1fc0

View File

@@ -20,7 +20,7 @@ PERCENT_RE = re.compile(r"(\d+\.\d+%)")
SPEED_RE = re.compile(r"(\d+\.\d+(?:MB|KB)ps)")
SIZE_RE = re.compile(r"(\d+\.\d+(?:MB|GB|KB)/\d+\.\d+(?:MB|GB|KB))")
WARN_RE = re.compile(r"(WARN : Response.*|WARN : One or more errors occurred.*)")
ERROR_RE = re.compile(r"(ERROR.*|error.*|Error.*|FAILED.*|Failed.*|Exception.*)")
ERROR_RE = re.compile(r"(\bERROR\b.*|\bFAILED\b.*|\bException\b.*)")
DECRYPTION_ENGINE = {
"shaka": "SHAKA_PACKAGER",
@@ -276,18 +276,6 @@ def download(
if not binaries.N_m3u8DL_RE:
raise EnvironmentError("N_m3u8DL-RE executable not found...")
decryption_engine = config.decryption.lower()
binary_path = None
if content_keys:
if decryption_engine == "shaka":
binary_path = binaries.ShakaPackager
elif decryption_engine == "mp4decrypt":
binary_path = binaries.Mp4decrypt
if binary_path:
binary_path = Path(binary_path)
effective_max_workers = max_workers or min(32, (os.cpu_count() or 1) + 4)
if proxy and not config.n_m3u8dl_re.get("use_proxy", True):
@@ -349,12 +337,6 @@ def download(
yield {"total": 100}
yield {"downloaded": "Parsing streams..."}
env = os.environ.copy()
if binary_path and binary_path.exists():
binary_dir = str(binary_path.parent)
env["PATH"] = binary_dir + os.pathsep + env["PATH"]
try:
with subprocess.Popen(
[binaries.N_m3u8DL_RE, *arguments],
@@ -362,7 +344,6 @@ def download(
stderr=subprocess.STDOUT,
text=True,
encoding="utf-8",
env=env, # Assign to virtual environment variables
) as process:
last_line = ""
track_type = track.__class__.__name__