sarperavci / CloudflareBypassForScraping

A cloudflare verification bypass script for webscraping
344 stars 61 forks source link

No display in Ubuntu #5

Open Keramatfar opened 3 months ago

Keramatfar commented 3 months ago

I try the test in ubuntu but no windows is opening.

sarperavci commented 3 months ago

Do you have Chrome or Chromium based browser on your machine?

Keramatfar commented 3 months ago

Yes, I have chrome, and chromium both. Also, I got this error:1、该端口为浏览器 2、已添加'--remote-debugging-port=9222'启动项 3、用户文件夹没有和已打开的浏览器冲突 4、如为无界面系统,请添加'--headless=new'参数 5、如果是Linux系统,可能还要添加'--no-sandbox'启动参数 可使用ChromiumOptions设置端口和用户文件夹路径。 I noticed that I can run drissionpage in headless mode, but when I try to make It visible it occurs.

sarperavci commented 3 months ago

Try this instead of test.py

from CloudflareBypasser import CloudflareBypasser
from DrissionPage import ChromiumPage
import time
driver = ChromiumPage( )
driver.get('https://nopecha.com/demo/cloudflare')
# Where the bypass starts
cf_bypasser = CloudflareBypasser(driver)
cf_bypasser.bypass()
print("Enjoy the content!")
#print(driver.html) # You can extract the content of the page.
print("Title of the page: ", driver.title)
time.sleep(5)
driver.quit()
Keramatfar commented 3 months ago

Thanks, but the same situation and error.

sarperavci commented 3 months ago

Could you share your console output? I need to see it.

Keramatfar commented 3 months ago

without sudo: cd /home/.../Desktop/test/CloudflareBypassForScraping-main ; /usr/bin/env /bin/python /home/.../.vscode/extensions/ms-python.debugpy-2024.6.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 49459 -- /home/.../Desktop/test/CloudflareBypassForScraping-main/test.py Traceback (most recent call last): File "/home/.../Desktop/test/CloudflareBypassForScraping-main/test.py", line 4, in driver = ChromiumPage( ) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_pages/chromium_page.py", line 37, in new is_exist, browser_id = run_browser(opt) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_pages/chromium_page.py", line 309, in run_browser is_exist = connect_browser(chromium_options) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_functions/browser.py", line 43, in connect_browser set_prefs(option) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_functions/browser.py", line 135, in set_prefs os.chmod(prefs_file, 0o666) PermissionError: [Errno 13] Permission denied: '/tmp/DrissionPage/userData_9222/Default/Preferences' ...@...-virtual-machine:~/Desktop/test/CloudflareBypassForScraping-main$ with sudo: Traceback (most recent call last): File "/home/.../Desktop/test/CloudflareBypassForScraping-main/test.py", line 4, in driver = ChromiumPage( ) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_pages/chromium_page.py", line 37, in new is_exist, browser_id = run_browser(opt) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_pages/chromium_page.py", line 309, in run_browser is_exist = connect_browser(chromium_options) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_functions/browser.py", line 57, in connect_browser test_connect(ip, port) File "/usr/local/lib/python3.10/dist-packages/DrissionPage-4.0.4.5-py3.10.egg/DrissionPage/_functions/browser.py", line 213, in test_connect raise BrowserConnectError(f'\n{ip}:{port}浏览器无法链接。\n请确认:\n1、该端口为浏览器\n' DrissionPage.errors.BrowserConnectError: 127.0.0.1:9222浏览器无法链接。 请确认: 1、该端口为浏览器 2、已添加'--remote-debugging-port=9222'启动项 3、用户文件夹没有和已打开的浏览器冲突 4、如为无界面系统,请添加'--headless=new'参数 5、如果是Linux系统,可能还要添加'--no-sandbox'启动参数 可使用ChromiumOptions设置端口和用户文件夹路径。

sarperavci commented 3 months ago

This error is probably related to DrissionPage because you can't initiate a Chromium page at all.

Tired-cat commented 2 months ago

Hi i wanted to use this but when i want to install CloudflareBypasser using ' pip install CloudflareBypasser ' but it doesn't exist that is because every time i try to run they python file only installing 'pip install DrissionPage' i get a message from the terminal that No module named 'CloudflareBypasser' is not found

sarperavci commented 2 months ago

Hi i wanted to use this but when i want to install CloudflareBypasser using ' pip install CloudflareBypasser ' but it doesn't exist that is because every time i try to run they python file only installing 'pip install DrissionPage' i get a message from the terminal that No module named 'CloudflareBypasser' is not found

It's not included in PyPI. To import CloudflareBypasser, copy CloudflareBypasser.py to your project path.

Tired-cat commented 2 months ago

Thank you it works now!

luciancurteanu commented 1 week ago

Same here...Its not working on centos 9 x64 https://www.sellmymobile.com/phones/apple/iphone-11-pro-max/?capacity=64