f
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -51,6 +51,7 @@ Medios-Macina is a API driven file media manager and virtual toolbox capable of
|
||||
<summary>COMMAND LINE</summary>
|
||||
|
||||
<pre><code>
|
||||
curl -sSL https://code.glowers.club/goyimnose/Medios-Macina/raw/branch/main/scripts/bootstrap.py | python -
|
||||
</code></pre>
|
||||
|
||||
</details>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user