How to fix tiktok selenium robot detection

How to fix TikTok selenium robot detection


I'm creating a python selenium bot to do things on the TikTok website. The user will log in manually so the website detecting mouse movement and typing speed is irrelevant.The issue is, is that I can't log in while using selenium

What I've tried

  • I've tried logging in normally without selenium in incognito mode on chrome with the same Mac address, IP address, and same login details (Which worked!!)

  • I've tried using random user agents in selenium (Which didn't Work)

  • I've tried adding the following chrome options


# Chrome is controlled by automated test software
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)

# avoiding detection

What I want

I want to be able to log in without TikTok saying Too many log-in attempts. Try again later and for more clarification, I can log in normally without selenium same everything and it works it just doesn't work while in selenium.

Heres is the code for starting selenium

post = ""

myProxy = ""

options = Options()
prox = Proxy()
prox.proxy_type = ProxyType.MANUAL
prox.http_proxy = myProxy
prox.ssl_proxy = myProxy

capabilities = webdriver.DesiredCapabilities.CHROME


driver = webdriver.Chrome(executable_path = os.path.join(os.getcwd(), 'chromedriver'), options=options)

#opens tiktok login page

1 answer

  • answered 2022-05-06 16:53 Andrew Horowitz

    A few things that might help:

    1. Make sure your proxy is changing during every login attempt.

    2. For every instance of a new login create a new webdriver environment either with the same proxy or a new one.

    3. Add random wait times. For example instagram will restrict accounts that they suspect of botting. To fix this one solution is to make the selenium instance preform different clicking actions at different times. i.e. having a wait time fluctuating between a few seconds can do the trick.

    4. Also this code may help with too many login attempt issues. In short it helps selenium disguise itself better to the website servers when navigating the site.

       user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum