Upgraded youtube_download plugin

This commit is contained in:
2026-05-26 20:50:58 -05:00
parent d55bc3ae97
commit 38ea00ec8f
87 changed files with 3385 additions and 1424 deletions

View File

@@ -5,6 +5,7 @@ import dataclasses
import functools
import os.path
import sys
import sysconfig
from ._utils import _get_exe_version_output, detect_exe_version, version_tuple
@@ -13,6 +14,13 @@ _FALLBACK_PATHEXT = ('.COM', '.EXE', '.BAT', '.CMD')
def _find_exe(basename: str) -> str:
# Check in Python "scripts" path, e.g. for pipx-installed binaries
binary = os.path.join(
sysconfig.get_path('scripts'),
basename + sysconfig.get_config_var('EXE'))
if os.access(binary, os.F_OK | os.X_OK) and not os.path.isdir(binary):
return binary
if os.name != 'nt':
return basename
@@ -33,12 +41,12 @@ def _find_exe(basename: str) -> str:
else:
exts = tuple(ext for ext in pathext.split(os.pathsep) if ext)
visited = []
visited = set()
for path in map(os.path.realpath, paths):
normed = os.path.normcase(path)
if normed in visited:
continue
visited.append(normed)
visited.add(normed)
for ext in exts:
binary = os.path.join(path, f'{basename}{ext}')
@@ -79,7 +87,7 @@ class JsRuntime(abc.ABC):
class DenoJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (2, 0, 0)
MIN_SUPPORTED_VERSION = (2, 3, 0)
def _info(self):
path = _determine_runtime_path(self._path, 'deno')
@@ -94,7 +102,7 @@ class DenoJsRuntime(JsRuntime):
class BunJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (1, 0, 31)
MIN_SUPPORTED_VERSION = (1, 2, 11)
def _info(self):
path = _determine_runtime_path(self._path, 'bun')
@@ -109,7 +117,7 @@ class BunJsRuntime(JsRuntime):
class NodeJsRuntime(JsRuntime):
MIN_SUPPORTED_VERSION = (20, 0, 0)
MIN_SUPPORTED_VERSION = (22, 0, 0)
def _info(self):
path = _determine_runtime_path(self._path, 'node')

View File

@@ -75,6 +75,9 @@ MONTH_NAMES = {
'fr': [
'janvier', 'février', 'mars', 'avril', 'mai', 'juin',
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
'is': [
'janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní',
'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'],
# these follow the genitive grammatical case (dopełniacz)
# some websites might be using nominative, which will require another month list
# https://en.wikibooks.org/wiki/Polish/Noun_cases

View File

@@ -62,10 +62,10 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
if isinstance(source, tuple):
name, source, reviver = source
try:
resolved[source] = target[index] = reviver(target[index])
target[index] = reviver(target[index])
except Exception as error:
yield TypeError(f'failed to parse {source} as {name!r}: {error}')
resolved[source] = target[index] = None
target[index] = None
continue
if source in resolved:

View File

@@ -17,7 +17,7 @@ from .traversal import traverse_obj
def random_user_agent():
USER_AGENT_TMPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{} Safari/537.36'
# Target versions released within the last ~6 months
CHROME_MAJOR_VERSION_RANGE = (137, 143)
CHROME_MAJOR_VERSION_RANGE = (142, 148)
return USER_AGENT_TMPL.format(f'{random.randint(*CHROME_MAJOR_VERSION_RANGE)}.0.0.0')