ytdlp fixes

This commit is contained in:
Nick Sweeting
2025-12-29 13:26:50 -08:00
parent 92c26124a3
commit 73e977ea97
2 changed files with 18 additions and 15 deletions

View File

@@ -6,13 +6,20 @@
"YTDLP_ENABLED": { "YTDLP_ENABLED": {
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"x-aliases": ["MEDIA_ENABLED", "SAVE_MEDIA", "USE_MEDIA", "USE_YTDLP", "FETCH_MEDIA", "SAVE_YTDLP"], "x-aliases": [
"MEDIA_ENABLED",
"SAVE_MEDIA",
"USE_MEDIA",
"USE_YTDLP",
"FETCH_MEDIA",
"SAVE_YTDLP"
],
"description": "Enable video/audio downloading with yt-dlp" "description": "Enable video/audio downloading with yt-dlp"
}, },
"YTDLP_BINARY": { "YTDLP_BINARY": {
"type": "string", "type": "string",
"default": "yt-dlp", "default": "yt-dlp",
"x-aliases": ["MEDIA_BINARY", "YOUTUBEDL_BINARY", "YOUTUBE_DL_BINARY"], "x-aliases": ["YOUTUBEDL_BINARY", "YOUTUBE_DL_BINARY"],
"description": "Path to yt-dlp binary" "description": "Path to yt-dlp binary"
}, },
"YTDLP_NODE_BINARY": { "YTDLP_NODE_BINARY": {
@@ -46,15 +53,14 @@
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"x-fallback": "CHECK_SSL_VALIDITY", "x-fallback": "CHECK_SSL_VALIDITY",
"x-aliases": ["MEDIA_CHECK_SSL_VALIDITY"],
"description": "Whether to verify SSL certificates" "description": "Whether to verify SSL certificates"
}, },
"YTDLP_ARGS": { "YTDLP_ARGS": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": { "type": "string" },
"default": [ "default": [
"--restrict-filenames", "--restrict-filenames",
"--trim-filenames", "128", "--trim-filenames=128",
"--write-description", "--write-description",
"--write-info-json", "--write-info-json",
"--write-thumbnail", "--write-thumbnail",
@@ -68,16 +74,18 @@
"--geo-bypass", "--geo-bypass",
"--add-metadata", "--add-metadata",
"--no-progress", "--no-progress",
"-o", "%(title)s.%(ext)s" "--remote-components ejs:github",
"-o",
"%(title)s.%(ext)s"
], ],
"x-aliases": ["YTDLP_DEFAULT_ARGS", "MEDIA_ARGS"], "x-aliases": ["YTDLP_DEFAULT_ARGS"],
"description": "Default yt-dlp arguments" "description": "Default yt-dlp arguments"
}, },
"YTDLP_ARGS_EXTRA": { "YTDLP_ARGS_EXTRA": {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": { "type": "string" },
"default": [], "default": [],
"x-aliases": ["YTDLP_EXTRA_ARGS", "MEDIA_ARGS_EXTRA", "MEDIA_EXTRA_ARGS"], "x-aliases": ["YTDLP_EXTRA_ARGS"],
"description": "Extra arguments to append to yt-dlp command" "description": "Extra arguments to append to yt-dlp command"
} }
} }

View File

@@ -26,11 +26,6 @@ from pathlib import Path
import rich_click as click import rich_click as click
# Extractor metadata
PLUGIN_NAME = 'ytdlp'
BIN_NAME = 'yt-dlp'
BIN_PROVIDERS = 'pip,apt,brew,env'
OUTPUT_DIR = '.'
def get_env(name: str, default: str = '') -> str: def get_env(name: str, default: str = '') -> str:
@@ -91,7 +86,7 @@ def save_ytdlp(url: str, binary: str) -> tuple[bool, str | None, str]:
ytdlp_args_extra = get_env_array('YTDLP_ARGS_EXTRA', []) ytdlp_args_extra = get_env_array('YTDLP_ARGS_EXTRA', [])
# Output directory is current directory (hook already runs in output dir) # Output directory is current directory (hook already runs in output dir)
output_dir = Path(OUTPUT_DIR) output_dir = Path('.')
# Build command (later options take precedence) # Build command (later options take precedence)
cmd = [ cmd = [