mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-12 22:04:42 +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:
parent
b536d72c86
commit
98e42eb044
3
.github/workflows/challenge-tests.yml
vendored
3
.github/workflows/challenge-tests.yml
vendored
@ -54,8 +54,7 @@ jobs:
|
|||||||
- name: Install Bun
|
- name: Install Bun
|
||||||
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
with:
|
with:
|
||||||
# minimum supported version is 1.0.31 but earliest available Windows version is 1.1.0
|
bun-version: '1.2.11' # minimum supported version
|
||||||
bun-version: ${{ (matrix.os == 'windows-latest' && '1.1.0') || '1.0.31' }}
|
|
||||||
no-cache: true
|
no-cache: true
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class MockLogger:
|
|||||||
def debug(self, message: str, *, once=False):
|
def debug(self, message: str, *, once=False):
|
||||||
print(f'debug: {message}')
|
print(f'debug: {message}')
|
||||||
|
|
||||||
def info(self, message: str):
|
def info(self, message: str, *, once=False):
|
||||||
print(f'info: {message}')
|
print(f'info: {message}')
|
||||||
|
|
||||||
def warning(self, message: str, *, once=False):
|
def warning(self, message: str, *, once=False):
|
||||||
|
|||||||
@ -45,6 +45,8 @@ class BunJCP(EJSBaseJCP, BuiltinIEContentProvider):
|
|||||||
JS_RUNTIME_NAME = 'bun'
|
JS_RUNTIME_NAME = 'bun'
|
||||||
BUN_NPM_LIB_FILENAME = 'yt.solver.bun.lib.js'
|
BUN_NPM_LIB_FILENAME = 'yt.solver.bun.lib.js'
|
||||||
SUPPORTED_PROXY_SCHEMES = ['http', 'https']
|
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):
|
def _iter_script_sources(self):
|
||||||
yield from super()._iter_script_sources()
|
yield from super()._iter_script_sources()
|
||||||
@ -112,6 +114,19 @@ class BunJCP(EJSBaseJCP, BuiltinIEContentProvider):
|
|||||||
return options
|
return options
|
||||||
|
|
||||||
def _run_js_runtime(self, stdin: str, /) -> str:
|
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
|
# https://bun.com/docs/cli/run
|
||||||
options = ['--no-addons', '--prefer-offline']
|
options = ['--no-addons', '--prefer-offline']
|
||||||
if self._lib_script.variant == ScriptVariant.BUN_NPM:
|
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})'
|
msg = f'Error running bun process (returncode: {proc.returncode})'
|
||||||
if stderr:
|
if stderr:
|
||||||
msg = f'{msg}: {stderr.strip()}'
|
msg = f'{msg}: {stderr.strip()}'
|
||||||
raise JsChallengeProviderError(msg)
|
raise JsChallengeProviderError(msg, expected=is_unsupported_version)
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
def _clean_stderr(self, stderr):
|
def _clean_stderr(self, stderr):
|
||||||
|
|||||||
@ -64,9 +64,9 @@ class YoutubeIEContentProviderLogger(IEContentProviderLogger):
|
|||||||
if self.log_level <= self.LogLevel.DEBUG:
|
if self.log_level <= self.LogLevel.DEBUG:
|
||||||
self.__ie.write_debug(self._format_msg(message), only_once=once)
|
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:
|
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):
|
def warning(self, message: str, *, once=False):
|
||||||
if self.log_level <= self.LogLevel.WARNING:
|
if self.log_level <= self.LogLevel.WARNING:
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class IEContentProviderLogger(abc.ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def info(self, message: str):
|
def info(self, message: str, *, once=False):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class DenoJsRuntime(JsRuntime):
|
|||||||
|
|
||||||
|
|
||||||
class BunJsRuntime(JsRuntime):
|
class BunJsRuntime(JsRuntime):
|
||||||
MIN_SUPPORTED_VERSION = (1, 0, 31)
|
MIN_SUPPORTED_VERSION = (1, 2, 11)
|
||||||
|
|
||||||
def _info(self):
|
def _info(self):
|
||||||
path = _determine_runtime_path(self._path, 'bun')
|
path = _determine_runtime_path(self._path, 'bun')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user