2024-07-27 06:49:29 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
|
|
|
|
chromedriver,
|
|
|
|
python3,
|
|
|
|
|
|
|
|
testers,
|
|
|
|
}:
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2024-07-27 06:49:29 +00:00
|
|
|
pname = "undetected-chromedriver";
|
|
|
|
inherit (chromedriver) version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ (python3.withPackages (ps: [ ps.undetected-chromedriver ])) ];
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
|
|
|
|
cp ${chromedriver}/bin/chromedriver .
|
|
|
|
chmod +w chromedriver
|
|
|
|
|
|
|
|
python <<EOF
|
|
|
|
import logging
|
|
|
|
from undetected_chromedriver.patcher import Patcher
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
|
|
success = Patcher(executable_path="chromedriver").patch()
|
|
|
|
assert success, "Failed to patch ChromeDriver"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
install -D -m 0555 chromedriver $out/bin/undetected-chromedriver
|
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
meta = chromedriver.meta // {
|
|
|
|
description = "Custom Selenium ChromeDriver that passes all bot mitigation systems";
|
|
|
|
mainProgram = "undetected-chromedriver";
|
|
|
|
maintainers = with lib.maintainers; [ paveloom ];
|
|
|
|
};
|
2024-09-26 11:04:55 +00:00
|
|
|
})
|