enable_stealth not a valid option
Using the version from git:
scraper = cloudscraper.create_scraper(interpreter='js2py', delay=10, enable_stealth=True, stealth_options={"min_delay": 2.0, "max_delay": 10.0, "human_like_delays": True, "randomize_headers": True, "browser_quirks": True}, browser="firefox", debug=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/pixiv_stuff/venv/lib/python3.12/site-packages/cloudscraper/__init__.py", line 319, in create_scraper
scraper = cls(**kwargs)
^^^^^^^^^^^^^
File "/tmp/pixiv_stuff/venv/lib/python3.12/site-packages/cloudscraper/__init__.py", line 152, in __init__
super(CloudScraper, self).__init__(*args, **kwargs)
TypeError: Session.__init__() got an unexpected keyword argument 'enable_stealth'
This happens when you attempt to use enable_stealth meaning this isn't properly supported despite it being listed in the readme.
This happened to me as well. The issue was that pip install cloudscraper installed version 1.2.71, even though version 3.0.0 is available. To fix it, I removed the old version:
pip uninstall cloudscraper
Then I installed the latest version directly from GitHub:
pip install "git+https://github.com/VeNoMouS/cloudscraper.git"
However, after that I got this error:
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
└─> [21 lines of output]
I’m using Windows 10, and an AI assistant suggested setting this environment variable. It solved the installation problem for me:
For CMD:
set PYTHONUTF8=1
For PowerShell:
$env:PYTHONUTF8=1
After that, version 3.0.0 installed correctly.