yt-dlp: fix impersonation with curl-cffi (#460076)

This commit is contained in:
Sandro
2025-11-11 21:01:09 +00:00
committed by GitHub
+12 -2
View File
@@ -32,6 +32,10 @@ python3Packages.buildPythonApplication rec {
postPatch = ''
substituteInPlace yt_dlp/version.py \
--replace-fail "UPDATE_HINT = None" 'UPDATE_HINT = "Nixpkgs/NixOS likely already contain an updated version.\n To get it run nix-channel --update or nix flake update in your config directory."'
# Until yt-dlp supports curl-cffi 0.14.x, this patch is needed:
substituteInPlace yt_dlp/networking/_curlcffi.py \
--replace-fail "if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version < (0, 14)" \
"if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version"
'';
build-system = with python3Packages; [ hatchling ];
@@ -94,8 +98,14 @@ python3Packages.buildPythonApplication rec {
''--prefix PATH : "${lib.makeBinPath packagesToBinPath}"''
];
# Requires network
doCheck = false;
checkPhase = ''
# Check for "unsupported" string in yt-dlp -v output.
output=$($out/bin/yt-dlp -v 2>&1 || true)
if echo $output | grep -q "unsupported"; then
echo "ERROR: Found \"unsupported\" string in yt-dlp -v output."
exit 1
fi
'';
postInstall = ''
installManPage yt-dlp.1