1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-16 06:05:41 +07:00

Compare commits

...

3 Commits

Author SHA1 Message Date
matyb08
c96e9291ab [misc] Fix zsh path argument completion (#14953)
Closes #14952
Authored by: matyb08
2025-11-09 15:23:03 +00:00
bashonly
4b4223b436 Allow --js-runtimes to accept path to binary or directory (#14964)
Fix 6224a38988

Authored by: bashonly
2025-11-09 15:14:22 +00:00
bashonly
c63b4e2a2b [cleanup] Misc (#14767)
Authored by: bashonly, sepro, matyb08

Co-authored-by: sepro <sepro@sepr0.com>
Co-authored-by: matyb08 <suricate66@protonmail.com>
2025-11-09 14:07:10 +00:00
6 changed files with 69 additions and 30 deletions

View File

@@ -10,6 +10,8 @@ ## Core Maintainers
**You can contact the core maintainers via `maintainers@yt-dlp.org`.**
This is **NOT** a support channel. [Open an issue](https://github.com/yt-dlp/yt-dlp/issues/new/choose) if you need help or want to report a bug.
### [coletdjnz](https://github.com/coletdjnz)
[![gh-sponsor](https://img.shields.io/badge/_-Github-white.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/sponsors/coletdjnz)

View File

@@ -360,7 +360,7 @@ ## General Options:
containing directory ("-" for stdin). Can be
used multiple times and inside other
configuration files
--plugin-dirs PATH Path to an additional directory to search
--plugin-dirs DIR Path to an additional directory to search
for plugins. This option can be used
multiple times to add multiple directories.
Use "default" to search the default plugin
@@ -369,22 +369,33 @@ ## General Options:
including defaults and those provided by
previous --plugin-dirs
--js-runtimes RUNTIME[:PATH] Additional JavaScript runtime to enable,
with an optional path to the runtime
location. This option can be used multiple
times to enable multiple runtimes. Supported
runtimes: deno, node, bun, quickjs. By
default, only "deno" runtime is enabled.
with an optional location for the runtime
(either the path to the binary or its
containing directory). This option can be
used multiple times to enable multiple
runtimes. Supported runtimes are (in order
of priority, from highest to lowest): deno,
node, quickjs, bun. Only "deno" is enabled
by default. The highest priority runtime
that is both enabled and available will be
used. In order to use a lower priority
runtime when "deno" is available, --no-js-
runtimes needs to be passed before enabling
other runtimes
--no-js-runtimes Clear JavaScript runtimes to enable,
including defaults and those provided by
previous --js-runtimes
--remote-components COMPONENT Remote components to allow yt-dlp to fetch
when required. You can use this option
multiple times to allow multiple components.
Supported values: ejs:npm (external
JavaScript components from npm), ejs:github
(external JavaScript components from yt-dlp-
ejs GitHub). By default, no remote
components are allowed.
when required. This option is currently not
needed if you are using an official
executable or have the requisite version of
the yt-dlp-ejs package installed. You can
use this option multiple times to allow
multiple components. Supported values:
ejs:npm (external JavaScript components from
npm), ejs:github (external JavaScript
components from yt-dlp-ejs GitHub). By
default, no remote components are allowed
--no-remote-components Disallow fetching of all remote components,
including any previously allowed by
--remote-components or defaults.
@@ -1105,11 +1116,12 @@ ## SponsorBlock Options:
for, separated by commas. Available
categories are sponsor, intro, outro,
selfpromo, preview, filler, interaction,
music_offtopic, poi_highlight, chapter, all
and default (=all). You can prefix the
category with a "-" to exclude it. See [1]
for descriptions of the categories. E.g.
--sponsorblock-mark all,-preview
music_offtopic, hook, poi_highlight,
chapter, all and default (=all). You can
prefix the category with a "-" to exclude
it. See [1] for descriptions of the
categories. E.g. --sponsorblock-mark
all,-preview
[1] https://wiki.sponsor.ajay.app/w/Segment_Categories
--sponsorblock-remove CATS SponsorBlock categories to be removed from
the video file, separated by commas. If a
@@ -1174,7 +1186,7 @@ # CONFIGURATION
You can configure yt-dlp by placing any supported command line option in a configuration file. The configuration is loaded from the following locations:
1. **Main Configuration**:
* The file given to `--config-location`
* The file given to `--config-locations`
1. **Portable Configuration**: (Recommended for portable installations)
* If using a binary, `yt-dlp.conf` in the same directory as the binary
* If running from source-code, `yt-dlp.conf` in the parent directory of `yt_dlp`
@@ -1256,7 +1268,7 @@ ### Authentication with netrc
### Notes about environment variables
* Environment variables are normally specified as `${VARIABLE}`/`$VARIABLE` on UNIX and `%VARIABLE%` on Windows; but is always shown as `${VARIABLE}` in this documentation
* yt-dlp also allows using UNIX-style variables on Windows for path-like options; e.g. `--output`, `--config-location`
* yt-dlp also allows using UNIX-style variables on Windows for path-like options; e.g. `--output`, `--config-locations`
* If unset, `${XDG_CONFIG_HOME}` defaults to `~/.config` and `${XDG_CACHE_HOME}` to `~/.cache`
* On Windows, `~` points to `${HOME}` if present; or, `${USERPROFILE}` or `${HOMEDRIVE}${HOMEPATH}` otherwise
* On Windows, `${USERPROFILE}` generally points to `C:\Users\<user name>` and `${APPDATA}` to `${USERPROFILE}\AppData\Roaming`

4
devscripts/update_ejs.py Normal file → Executable file
View File

@@ -66,7 +66,9 @@ def list_wheel_contents(
) -> str:
assert folders or files, 'at least one of "folders" or "files" must be True'
path_gen = (zinfo.filename for zinfo in zipfile.ZipFile(io.BytesIO(wheel_data)).infolist())
with zipfile.ZipFile(io.BytesIO(wheel_data)) as zipf:
path_gen = (zinfo.filename for zinfo in zipf.infolist())
filtered = filter(lambda path: path.startswith('yt_dlp_ejs/'), path_gen)
if suffix:
filtered = filter(lambda path: path.endswith(f'.{suffix}'), filtered)

View File

@@ -18,6 +18,7 @@ def build_completion(opt_parser):
for opt in group.option_list]
opts_file = [opt for opt in opts if opt.metavar == 'FILE']
opts_dir = [opt for opt in opts if opt.metavar == 'DIR']
opts_path = [opt for opt in opts if opt.metavar == 'PATH']
fileopts = []
for opt in opts_file:
@@ -26,6 +27,12 @@ def build_completion(opt_parser):
if opt._long_opts:
fileopts.extend(opt._long_opts)
for opt in opts_path:
if opt._short_opts:
fileopts.extend(opt._short_opts)
if opt._long_opts:
fileopts.extend(opt._long_opts)
diropts = []
for opt in opts_dir:
if opt._short_opts:

View File

@@ -441,7 +441,7 @@ def _preset_alias_callback(option, opt_str, value, parser):
'("-" for stdin). Can be used multiple times and inside other configuration files'))
general.add_option(
'--plugin-dirs',
metavar='PATH',
metavar='DIR',
dest='plugin_dirs',
action='callback',
callback=_list_from_options_callback,
@@ -466,9 +466,13 @@ def _preset_alias_callback(option, opt_str, value, parser):
callback_kwargs={'delim': None},
default=['deno'],
help=(
'Additional JavaScript runtime to enable, with an optional path to the runtime location. '
'Additional JavaScript runtime to enable, with an optional location for the runtime '
'(either the path to the binary or its containing directory). '
'This option can be used multiple times to enable multiple runtimes. '
'Supported runtimes: deno, node, bun, quickjs. By default, only "deno" runtime is enabled.'))
'Supported runtimes are (in order of priority, from highest to lowest): deno, node, quickjs, bun. '
'Only "deno" is enabled by default. The highest priority runtime that is both enabled and '
'available will be used. In order to use a lower priority runtime when "deno" is available, '
'--no-js-runtimes needs to be passed before enabling other runtimes'))
general.add_option(
'--no-js-runtimes',
dest='js_runtimes', action='store_const', const=[],
@@ -484,9 +488,12 @@ def _preset_alias_callback(option, opt_str, value, parser):
default=[],
help=(
'Remote components to allow yt-dlp to fetch when required. '
'This option is currently not needed if you are using an official executable '
'or have the requisite version of the yt-dlp-ejs package installed. '
'You can use this option multiple times to allow multiple components. '
'Supported values: ejs:npm (external JavaScript components from npm), ejs:github (external JavaScript components from yt-dlp-ejs GitHub). '
'By default, no remote components are allowed.'))
'Supported values: ejs:npm (external JavaScript components from npm), '
'ejs:github (external JavaScript components from yt-dlp-ejs GitHub). '
'By default, no remote components are allowed'))
general.add_option(
'--no-remote-components',
dest='remote_components', action='store_const', const=[],

View File

@@ -2,6 +2,7 @@
import abc
import dataclasses
import functools
import os.path
from ._utils import _get_exe_version_output, detect_exe_version, int_or_none
@@ -12,6 +13,14 @@ def runtime_version_tuple(v):
return tuple(int_or_none(x, default=0) for x in v.split('.'))
def _determine_runtime_path(path, basename):
if not path:
return basename
if os.path.isdir(path):
return os.path.join(path, basename)
return path
@dataclasses.dataclass(frozen=True)
class JsRuntimeInfo:
name: str
@@ -38,7 +47,7 @@ class DenoJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (2, 0, 0)
def _info(self):
path = self._path or 'deno'
path = _determine_runtime_path(self._path, 'deno')
out = _get_exe_version_output(path, ['--version'])
if not out:
return None
@@ -53,7 +62,7 @@ class BunJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (1, 0, 31)
def _info(self):
path = self._path or 'bun'
path = _determine_runtime_path(self._path, 'bun')
out = _get_exe_version_output(path, ['--version'])
if not out:
return None
@@ -68,7 +77,7 @@ class NodeJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (20, 0, 0)
def _info(self):
path = self._path or 'node'
path = _determine_runtime_path(self._path, 'node')
out = _get_exe_version_output(path, ['--version'])
if not out:
return None
@@ -83,7 +92,7 @@ class QuickJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (2023, 12, 9)
def _info(self):
path = self._path or 'qjs'
path = _determine_runtime_path(self._path, 'qjs')
# quickjs does not have --version and --help returns a status code of 1
out = _get_exe_version_output(path, ['--help'], ignore_return_code=True)
if not out: