[rh:curl_cffi] Support curl_cffi 0.15.x (#16429)

* Remove the `curl-cffi-compat` extra
* Add impersonate targets missing from the curl_cffi 0.14.x bump
* Add curl-cffi to musllinux_aarch64 builds
* Migrate from delocate-fuse to delocate-merge
* Remove unnecessary wheel surgery step in macos build job
* Add macos_verify build job to verify on x86_64

Authored by: bashonly
This commit is contained in:
bashonly
2026-04-04 02:29:27 +00:00
committed by GitHub
parent 2d7b278666
commit 0f45ecc920
15 changed files with 398 additions and 140 deletions
+16 -4
View File
@@ -25,7 +25,7 @@ from .exceptions import (
)
from .impersonate import ImpersonateRequestHandler, ImpersonateTarget
from ..dependencies import curl_cffi, certifi
from ..utils import int_or_none
from ..utils import int_or_none, version_tuple
if curl_cffi is None:
raise ImportError('curl_cffi is not installed')
@@ -33,9 +33,9 @@ if curl_cffi is None:
curl_cffi_version = tuple(map(int, re.split(r'[^\d]+', curl_cffi.__version__)[:3]))
if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version < (0, 15):
if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version < (0, 16):
curl_cffi._yt_dlp__version = f'{curl_cffi.__version__} (unsupported)'
raise ImportError('Only curl_cffi versions 0.5.10 and 0.10.x through 0.14.x are supported')
raise ImportError('Only curl_cffi versions 0.5.10 and 0.10.x through 0.15.x are supported')
import curl_cffi.requests
from curl_cffi.const import CurlECode, CurlOpt
@@ -162,6 +162,18 @@ BROWSER_TARGETS: dict[tuple[int, ...], dict[str, ImpersonateTarget]] = {
'safari260': ImpersonateTarget('safari', '26.0', 'macos', '26'),
'safari260_ios': ImpersonateTarget('safari', '26.0', 'ios', '26.0'),
},
(0, 14): {
'chrome142': ImpersonateTarget('chrome', '142', 'macos', '26'),
'safari2601': ImpersonateTarget('safari', '26.0.1', 'macos', '26'),
},
(0, 15): {
'chrome145': ImpersonateTarget('chrome', '145', 'macos', '26'),
'chrome146': ImpersonateTarget('chrome', '146', 'macos', '26'),
# firefox144 was added in 0.14.0, but its UA had a typo in 0.14.0
# Ref: https://github.com/lexiforest/curl-impersonate/issues/234
'firefox144': ImpersonateTarget('firefox', '144', 'macos', '26'),
'firefox147': ImpersonateTarget('firefox', '147', 'macos', '26'),
},
}
# Needed for curl_cffi < 0.11
@@ -206,7 +218,7 @@ class CurlCFFIRH(ImpersonateRequestHandler, InstanceStoreMixin):
# prioritize tor < edge < firefox < safari < chrome
('tor', 'edge', 'firefox', 'safari', 'chrome').index(x[1].client),
# prioritize newest version
float(x[1].version) if x[1].version else 0,
version_tuple(x[1].version or '0'),
# group by os name
x[1].os,
), reverse=True)).items()