我和我的两个朋友想编写一个创建 Instagram 帐户的机器人。 我们以前从未使用过 Python,所以对这个话题都很陌生。 机器人现在所做的是打开 Instagram,接受 cookie,输入电子邮件名称用户名和密码。然后它应该按下继续按钮,对于具有相同代码的朋友,它可以工作,但不适用于我。我什至不能自己点击按钮,它只是没有反应, 现在的问题是……为什么? 我们有相同的 Python 版本 (3.9) 代码如下:
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
from selenium.webdriver.common.keys import Keys
datei = open('Mail.txt','a')
def getMail():
return str(requests.get("https://1secmail.com/api/v1/?action=genRandomMailbox&count=1").content)[1:].replace(
'"' , "").replace("[", "").replace("]", "").replace("'", "")
def getIds(email):
r = str(requests.get("https://www.1secmail.com/api/v1/?action=getMessages&login="+email.split("@")[0]+"&domain="+email.split("@")[1]).content)
alll = r.split("id")
for i in range(len(alll)):
al = alll[i].split(",")[0].replace('"'+"", "").replace(":", "")
alll[i] = al
alll.pop(0)
return alll
#driver = webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe")
driver = webdriver.Chrome("C:\Program Files (x86)\Chrome Driver\chromedriver.exe")
driver.get("https://www.instagram.com/accounts/emailsignup/")
acceptButton = driver.find_element_by_tag_name("BUTTON").click()
try:
passwordInput = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.NAME, "password"))
)
finally:
passwordInput = driver.find_element_by_name("password")
passwordInput.send_keys("no i wont show u guys the password")
fullnameInput = driver.find_element_by_name("fullName")
fullnameInput.send_keys("Peter Berger")
usernameInput = driver.find_element_by_name("username")
usernameInput.send_keys("Poggedwdaw2323drs69420")
mail = getMail()
emailInput = driver.find_element_by_name("emailOrPhone")
emailInput.send_keys(mail)
datei.write("\n" + mail)
confirmButton = driver.find_element_by_xpath("//button[@type='submit']").click()
quit()```
答案 0 :(得分:0)
2 Friends of mine and I want to programm a Bot that creates Instagram Accounts.
这违反了 Instagram 的服务条款。通过在 Instagram 上实现自动化,你不会走得太远。即使您可以自动创建帐户,您也无法很容易地自动使用该帐户。这可能是破坏性的,因为他们可以告诉您正在自动化。