[ie/youtube] Drop support for bun<1.2.11 and bun>1.3.14 (#16786)

Closes #16766
Authored by: bashonly
This commit is contained in:
bashonly
2026-05-24 18:07:42 -05:00
committed by GitHub
parent b536d72c86
commit 98e42eb044
6 changed files with 22 additions and 8 deletions

View File

@@ -54,8 +54,7 @@ jobs:
- name: Install Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
# minimum supported version is 1.0.31 but earliest available Windows version is 1.1.0
bun-version: ${{ (matrix.os == 'windows-latest' && '1.1.0') || '1.0.31' }}
bun-version: '1.2.11' # minimum supported version
no-cache: true
- name: Install Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0

View File

@@ -45,7 +45,7 @@ class MockLogger:
def debug(self, message: str, *, once=False):
print(f'debug: {message}')
def info(self, message: str):
def info(self, message: str, *, once=False):
print(f'info: {message}')
def warning(self, message: str, *, once=False):

View File

@@ -45,6 +45,8 @@ class BunJCP(EJSBaseJCP, BuiltinIEContentProvider):
JS_RUNTIME_NAME = 'bun'
BUN_NPM_LIB_FILENAME = 'yt.solver.bun.lib.js'
SUPPORTED_PROXY_SCHEMES = ['http', 'https']
_BUN_MAX_SUPPORTED_VERSION = (1, 3, 14)
_BUN_DEPRECATION_URL = 'https://github.com/yt-dlp/yt-dlp/issues/16766'
def _iter_script_sources(self):
yield from super()._iter_script_sources()
@@ -112,6 +114,19 @@ class BunJCP(EJSBaseJCP, BuiltinIEContentProvider):
return options
def _run_js_runtime(self, stdin: str, /) -> str:
is_unsupported_version = self.runtime_info.version_tuple > self._BUN_MAX_SUPPORTED_VERSION
if is_unsupported_version:
self.logger.warning(
f'bun version {".".join(map(str, self.runtime_info.version_tuple))} is not supported! '
f'{".".join(map(str, self._BUN_MAX_SUPPORTED_VERSION))} is the last supported bun version. '
f'{self.ie._downloader._format_err("DO NOT", self.ie._downloader.Styles.ERROR)} '
f'open a bug report even if you encounter any errors!',
once=True)
else:
self.logger.info(
f'bun support has been deprecated. See {self._BUN_DEPRECATION_URL} for details',
once=True)
# https://bun.com/docs/cli/run
options = ['--no-addons', '--prefer-offline']
if self._lib_script.variant == ScriptVariant.BUN_NPM:
@@ -136,7 +151,7 @@ class BunJCP(EJSBaseJCP, BuiltinIEContentProvider):
msg = f'Error running bun process (returncode: {proc.returncode})'
if stderr:
msg = f'{msg}: {stderr.strip()}'
raise JsChallengeProviderError(msg)
raise JsChallengeProviderError(msg, expected=is_unsupported_version)
return stdout
def _clean_stderr(self, stderr):

View File

@@ -64,9 +64,9 @@ class YoutubeIEContentProviderLogger(IEContentProviderLogger):
if self.log_level <= self.LogLevel.DEBUG:
self.__ie.write_debug(self._format_msg(message), only_once=once)
def info(self, message: str):
def info(self, message: str, *, once=False):
if self.log_level <= self.LogLevel.INFO:
self.__ie.to_screen(self._format_msg(message))
self.__ie.to_screen(self._format_msg(message), only_once=once)
def warning(self, message: str, *, once=False):
if self.log_level <= self.LogLevel.WARNING:

View File

@@ -40,7 +40,7 @@ class IEContentProviderLogger(abc.ABC):
pass
@abc.abstractmethod
def info(self, message: str):
def info(self, message: str, *, once=False):
pass
@abc.abstractmethod

View File

@@ -102,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')