-
-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] BOT detected when headless mode #614
Comments
In my case, I needed the browser to run in a headfull mode in a docker container + vnc.
entrypoint.sh #! /bin/sh
export DISPLAY=${DISPLAY:-:0} # Select screen 0 by default.
export XVFB_SCREEN_SIZE=${XVFB_SCREEN_SIZE:-1024x768x24}
export X11VNC_PASSWORD=${X11VNC_PASSWORD:-password}
xdpyinfo
rm -rf /tmp/.X99-lock
rm -rf .X11-unix
sleep 1
! pgrep -a Xvfb && Xvfb $DISPLAY -screen 0 ${XVFB_SCREEN_SIZE} -ac &
sleep 1
if which x11vnc &>/dev/null; then
# ! pgrep -a x11vnc && x11vnc -bg -forever -passwd ${X11VNC_PASSWORD} -ncache 10 -ncache_cr -quiet -display WAIT$DISPLAY &
! pgrep -a x11vnc && x11vnc -bg --shared -forever -passwd ${X11VNC_PASSWORD} -quiet -display WAIT$DISPLAY &
fi
if which fluxbox &>/dev/null; then
! pgrep -a fluxbox && fluxbox 2>/dev/null &
fi
echo "IP: $(hostname -I) ($(hostname))"
exec "$@"
|
Using just Xvfb solved most of these problems for me. There is an older xvfb for node that one could use to manage the screens. Essentially run xvfb via the package (or a homemade script) and push to that display via the launch args in puppeteer. IIRC it would be something like
|
I've tried using xvfb. But always error, when
I don't understand, is this because my PC doesn't support it, or I'm wrong in the installation? |
Can you provide the error you are getting?
|
Thank you very much. Finally, my problem was solved with Xvfb module. But I'm still curious about the initial parameters in the module. Like the following example:
if I don't set Indeed, this code (module) is executed with different parameters. So I thought, there was a crash in using the screen. Is my guess correct? So, in your opinion, should each module create its own virtual monitor? or all leads to one virtual monitor? Because I don't really understand, how to create a virtual monitor? how many can be created? etc. |
Sure :) The reuse option is really just dependent on the use case. From the docs, |
I have the exact same issue... except I'm on Windows. The protection service on the website I'm trying to scrape is "StackPath." It passes after a few seconds without headless mode, but it gets blocked instantly with headless mode. |
for me google detects i'm headless. does anyone have a fix for this? I don't want to add a display to my environment, I need headless. |
Describe the bug
if I set headless mode, open the web that I scrap detects as BOT.
I know that this is because of WAF. so that it is taken to /_Incapsula_Resource? blah..bla...bla
Any ideas to bypass this problem?
Because if I force it to set headless=false, then the problem I face is that my OS is Linux, which doesn't have a GUI.
Versions
"dependencies": { "cheerio": "*", "express": "^4.17.1", "moment": "^2.29.1", "mongodb": "^4.2.0", "mysql": "^2.18.1", "puppeteer-extra": "^3.2.3", "puppeteer-extra-plugin-adblocker": "^2.12.0", "puppeteer-extra-plugin-stealth": "^2.9.0", "request-promise": "^4.2.6", "shelljs": "^0.8.4", "socket.io": "^4.4.0", "socket.io-client": "^4.4.0", "sprintf-js": "^1.1.2", "telegraf": "^4.5.2", "util": "^0.12.4" }
The text was updated successfully, but these errors were encountered: