mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-07-22 17:37:16 +00:00
[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:
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user