正在使用带重置密码的Selenium TikTok(python)进行检测

2024-09-29 00:18:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我的目标是每x天重置一次tiktok帐户的密码,我的过程从如何使用电子邮件重置tiktok帐户的密码开始。我写了一个代码,从一个包含我所有帐户电子邮件的txt文件中获取我的电子邮件。问题是,每次我尝试重置我的帐户时,它都会显示“您试图太频繁地使用我们的服务。这只发生在我使用selenium浏览器时,在普通浏览器上工作正常。我尝试使用UserAgent,尝试从chrome驱动程序中删除$csh,但没有解决方案

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

#iniatialization of the driver
options = webdriver.ChromeOptions()

options.add_argument(f'user-agent=Googlebot')


browser = webdriver.Chrome(chrome_options=options)
#puts all the links into a username
with open('list.txt', 'r') as f:
    emails = [line.strip() for line in f]


for email in emails:
    browser.get('https://www.tiktok.com/login/email/forget-password')
    time.sleep(2)
    inputEmail= browser.find_element_by_xpath('//*[@id="root"]/div/div[1]/form/div[2]/div/input')
    inputEmail.send_keys(str(email))
    browser.find_element_by_xpath('//*[@id="root"]/div/div[1]/form/div[3]/button').click()
    time.sleep(1)
    #didnt continue the code because this was not working 

可能的解决办法是什么


Tags: thefromimportdivbrowserbytime电子邮件