From c86aae1ff6451c80635cbf4dccaa2ada3d600fb2 Mon Sep 17 00:00:00 2001 From: Nose Date: Mon, 9 Feb 2026 17:22:40 -0800 Subject: [PATCH] f --- API/data/alldebrid.json | 2 +- SYS/config.py | 1 + cmdlet/download_file.py | 38 ++++++++++++++++++++------------------ readme.md | 1 + tool/ytdlp.py | 15 ++++++++++++--- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/API/data/alldebrid.json b/API/data/alldebrid.json index f092372..15a2dab 100644 --- a/API/data/alldebrid.json +++ b/API/data/alldebrid.json @@ -92,7 +92,7 @@ "(hitfile\\.net/[a-z0-9A-Z]{4,9})" ], "regexp": "(hitf\\.(to|cc)/([a-z0-9A-Z]{4,9}))|(htfl\\.(net|to|cc)/([a-z0-9A-Z]{4,9}))|(hitfile\\.(net)/download/free/([a-z0-9A-Z]{4,9}))|((hitfile\\.net/[a-z0-9A-Z]{4,9}))", - "status": true + "status": false }, "mega": { "name": "mega", diff --git a/SYS/config.py b/SYS/config.py index e02c2de..4c2e5ff 100644 --- a/SYS/config.py +++ b/SYS/config.py @@ -11,6 +11,7 @@ import datetime import sys import getpass import hashlib +import tempfile from copy import deepcopy from pathlib import Path from typing import Any, Dict, List, Optional, Tuple diff --git a/cmdlet/download_file.py b/cmdlet/download_file.py index c74d6b5..3411eb2 100644 --- a/cmdlet/download_file.py +++ b/cmdlet/download_file.py @@ -23,7 +23,6 @@ from SYS.pipeline_progress import PipelineProgress from SYS.result_table import Table from SYS.rich_display import stderr_console as get_stderr_console from SYS import pipeline as pipeline_context -from SYS.utils import sha256_file from SYS.metadata import normalize_urls as normalize_url_list from tool.ytdlp import ( @@ -1443,6 +1442,7 @@ class Download_File(Cmdlet): for url in supported_url: try: debug(f"[download-file] Processing URL in loop: {url}") + debug(f"[download-file] ytdl_format parameter passed in: {ytdl_format}") canonical_url = url if not skip_per_url_preflight or clip_ranges: @@ -1493,7 +1493,6 @@ class Download_File(Cmdlet): ): actual_format = forced_single_format_id forced_single_applied = True - if ( actual_format and isinstance(actual_format, str) @@ -1519,7 +1518,7 @@ class Download_File(Cmdlet): if vcodec != "none" and acodec == "none": debug(f"Selected video-only format {actual_format}; using {actual_format}+ba for audio") actual_format = f"{actual_format}+ba" - except Exception: + except Exception as e: pass attempted_single_format_fallback = False @@ -1941,22 +1940,27 @@ class Download_File(Cmdlet): height_selector = None if query_format and not query_wants_audio: try: - height_selector = ytdlp_tool.resolve_height_selector(query_format) + # Check if this looks like a YouTube format ID (used when selecting from format table) + # Format IDs are typically 3 digits and come from user selections + # Only treat as height if it looks like a resolution (ends with 'p' or is 1080+) + is_likely_format_id = ( + len(str(query_format).strip()) == 3 and + str(query_format).strip().isdigit() + ) + + if not is_likely_format_id: + height_selector = ytdlp_tool.resolve_height_selector(query_format) except Exception: height_selector = None - if height_selector: + if query_wants_audio: + # Explicit audio request should map to best-audio-only selector + ytdl_format = "ba" + elif height_selector: ytdl_format = height_selector - else: - import re - - if re.match(r"^\s*#?\d+\s*$", str(query_format)): - # Numeric format like "720" or "1080p" - will be resolved later via resolve_height_selector - # Don't set ytdl_format yet; let it fall through to per-URL resolution - pass - else: - # Non-numeric format string - use as literal - ytdl_format = query_format - debug(f"DEBUG: [download-file] Using literal query_format '{query_format}' as ytdl_format") + elif query_format: + # Use query_format as literal format ID (e.g., from table selection like '251') + ytdl_format = query_format + playlist_selection_handled = False if len(supported_url) == 1 and not playlist_items: @@ -1965,10 +1969,8 @@ class Download_File(Cmdlet): # If query_format is provided and numeric, resolve it now. if query_format and not query_wants_audio and not ytdl_format: try: - debug(f"[download-file] Resolving format for {candidate_url} (query='{query_format}')...") idx_fmt = self._format_id_for_query_index(query_format, candidate_url, formats_cache, ytdlp_tool) if idx_fmt: - debug(f"Resolved format selection '{query_format}' -> {idx_fmt}") ytdl_format = idx_fmt except ValueError as e: # Fallback: Treat as literal format if resolution fails or it's not a valid row index. diff --git a/readme.md b/readme.md index f0b8670..1949aaa 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,7 @@ Medios-Macina is a API driven file media manager and virtual toolbox capable of COMMAND LINE
 
+curl -sSL https://code.glowers.club/goyimnose/Medios-Macina/raw/branch/main/scripts/bootstrap.py | python -
 
diff --git a/tool/ytdlp.py b/tool/ytdlp.py index c541f2f..c8233da 100644 --- a/tool/ytdlp.py +++ b/tool/ytdlp.py @@ -999,9 +999,18 @@ class YtDlpTool: pass if ytdl_format and opts.mode != "audio": - resolved = self.resolve_height_selector(ytdl_format) - if resolved: - ytdl_format = resolved + # Don't resolve 3-digit format IDs (like 251, 249, 140 from YouTube format tables) as heights + # YouTube format IDs are typically 2-3 digits representing specific codec/quality combinations + # Height selectors come from user input like "720" or "1080p" + is_likely_format_id = ( + isinstance(ytdl_format, str) and + len(ytdl_format.strip()) == 3 and + ytdl_format.strip().isdigit() + ) + if not is_likely_format_id: + resolved = self.resolve_height_selector(ytdl_format) + if resolved: + ytdl_format = resolved fmt = ytdl_format or self.default_format(opts.mode) base_options["format"] = fmt