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": {
"type": "boolean",
"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"
},
"YTDLP_BINARY": {
"type": "string",
"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"
},
"YTDLP_NODE_BINARY": {
@@ -46,15 +53,14 @@
"type": "boolean",
"default": true,
"x-fallback": "CHECK_SSL_VALIDITY",
"x-aliases": ["MEDIA_CHECK_SSL_VALIDITY"],
"description": "Whether to verify SSL certificates"
},
"YTDLP_ARGS": {
"type": "array",
"items": {"type": "string"},
"items": { "type": "string" },
"default": [
"--restrict-filenames",
"--trim-filenames", "128",
"--trim-filenames=128",
"--write-description",
"--write-info-json",
"--write-thumbnail",
@@ -68,16 +74,18 @@
"--geo-bypass",
"--add-metadata",
"--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"
},
"YTDLP_ARGS_EXTRA": {
"type": "array",
"items": {"type": "string"},
"items": { "type": "string" },
"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"
}
}

View File

@@ -26,11 +26,6 @@ from pathlib import Path
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:
@@ -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', [])
# 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)
cmd = [