0

So we made a discord bot that uses selenium and decided to host it on heroku but when we tried to access the the website a cloudflare captcha tests comes up and we are unable to get past it .

We then found out about undetectable chromedriver but it is still unable to bypass the cloudflare test.

The website we are trying to access is https://aternos.org/:en/

Is what we are trying to achieve just not possible ? If so are there any other website we could try to host this bot.

The code is attached bellow:

from selenium.webdriver.common.keys import Keys
import time
import os
import undetected_chromedriver.v2 as uc

options = uc.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("headless")
options.add_argument("--disable-blink-features=AutomationControlled")
driver = uc.Chrome(options=options)
driver.get("https://aternos.org/go")
USERNAME_C = os.environ.get("USERNAME_C")
PASSWORD_C = os.environ.get("PASSWORD_C")
BOT_TOKEN = os.environ.get("BOT_TOKEN")

time.sleep(15)

Any help is appreciated!

1 Answers1

0

Your question has no relevance to Discord. The failure is not connected to it.


To bypass cloudflare you have to use e.g. cloudscraper.

Furthermore you need to install node.js buildpack alongside of your python buildpack:

Due to Cloudflare continually changing and hardening their protection page, cloudscraper requires a JavaScript Engine/interpreter to solve Javascript challenges. This allows the script to easily impersonate a regular web browser without explicitly deobfuscating and parsing Cloudflare's Javascript.

You will have to ensure that your project is compatible with nodejs buildpack (adding package.json on root directory of your git repo.)

To bypass not a bot captchas you also need to pay cloudscraper. You'll get an API key that is authorized. If it is just a cloudflare redirect and does not require any input then you'll have to do nothing.


In general it is always a race. Cloudflare will try to break your circumvention. Cloudscraper needs to update their code. You need to update the library dependency etc. You may also catch a time where there is no finished solution to circumvent at that time.

Tin Nguyen
  • 5,250
  • 1
  • 12
  • 32