diff --git a/.github/workflows/challenge-tests.yml b/.github/workflows/challenge-tests.yml index 36f973f9b7..f55cf68f47 100644 --- a/.github/workflows/challenge-tests.yml +++ b/.github/workflows/challenge-tests.yml @@ -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 diff --git a/test/test_jsc/conftest.py b/test/test_jsc/conftest.py index 28d6734122..07c30b7b06 100644 --- a/test/test_jsc/conftest.py +++ b/test/test_jsc/conftest.py @@ -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): diff --git a/yt_dlp/extractor/youtube/jsc/_builtin/bun.py b/yt_dlp/extractor/youtube/jsc/_builtin/bun.py index 8b0a6e5510..3f6dff0a71 100644 --- a/yt_dlp/extractor/youtube/jsc/_builtin/bun.py +++ b/yt_dlp/extractor/youtube/jsc/_builtin/bun.py @@ -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): diff --git a/yt_dlp/extractor/youtube/pot/_director.py b/yt_dlp/extractor/youtube/pot/_director.py index ae1edc46ae..9e467c8092 100644 --- a/yt_dlp/extractor/youtube/pot/_director.py +++ b/yt_dlp/extractor/youtube/pot/_director.py @@ -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: diff --git a/yt_dlp/extractor/youtube/pot/_provider.py b/yt_dlp/extractor/youtube/pot/_provider.py index 3aa467342f..0ba7c3039f 100644 --- a/yt_dlp/extractor/youtube/pot/_provider.py +++ b/yt_dlp/extractor/youtube/pot/_provider.py @@ -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 diff --git a/yt_dlp/utils/_jsruntime.py b/yt_dlp/utils/_jsruntime.py index a1a647e670..b77bb9fd05 100644 --- a/yt_dlp/utils/_jsruntime.py +++ b/yt_dlp/utils/_jsruntime.py @@ -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')