Answer the question
In order to leave comments, you need to log in
Why does the Site not see sent messages?
I wrote a bot for live broadcasts of tik tok, which sends messages from the txt file, the problem is that they are sent, but if you look from another account, this message will not be visible, why?
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
options = webdriver.EdgeOptions()
#options.add_argument('--headless')
user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.0 Safari/537.36 (compatible; Yeti/1.1; +http://naver.me/spd)'
options.add_argument('--disable-blink-featuresAutomationControlled')
options.add_argument("--disable-extensions")
options.add_argument("--proxy-server='direct://'")
options.add_argument("--proxy-bypass-list=*")
options.add_argument("--start-maximized")
options.add_argument('--disable-gpu')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--no-sandbox')
options.add_argument('--ignore-certificate-errors')
options.add_argument(f'user-agent={user_agent}')
driver = webdriver.Edge(options=options)
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": """
const newProto = navigator.__proto__
delete newProto.webdriver
navigator.__proto__ = newProto
"""
})
try:
driver.get('https://www.tiktok.com/@sherusmonov7/live')#url
sleep(5)
iframe = driver.find_element(By.XPATH,'//iframe[@class="tiktok-tpndsz-IframeLoginSite eaxh4gs3"]')
sleep(3)
driver.switch_to.frame(iframe)
vk_login = driver.find_elements(By.XPATH,'//div[@class="channel-name-2qzLW"]')[2].click()
driver.switch_to.window(driver.window_handles[1])
email = driver.find_element(By.NAME,'email')
email.clear()
email.send_keys('Your male or phone number')#Your male or phone number
sleep(1)
password = driver.find_element(By.NAME,'pass')
password.clear()
password.send_keys('Password',Keys.ENTER)#enter yor password
sleep(3)
print('Авторизация завешена')
driver.switch_to.window(driver.window_handles[0])
sleep(15)
#sound_off = driver.find_element(By.XPATH,'div["data-testid=volume-icon-id="]').click()
file = open('text.txt','r',encoding='utf-8')
try:
driver.refresh()
sleep(3)
for line in file:
pseudo_input = driver.find_element(By.CSS_SELECTOR, ".tiktok-19dw2t5-DivLayoutContainer")
( ActionChains(driver)
.move_to_element(pseudo_input)
.click(pseudo_input)
.pause(10)
.send_keys_to_element(pseudo_input,line)
.pause(1)
.send_keys_to_element(pseudo_input, Keys.ENTER)
.perform()
)
except:
driver.refresh()
sleep(3)
for line in file:
pseudo_input = driver.find_element(By.CSS_SELECTOR, ".tiktok-f9qhw2-DivInputAreaContainer")
(ActionChains(driver)
.move_to_element(pseudo_input)
.click(pseudo_input)
.pause(10)
.send_keys_to_element(pseudo_input, line)
.pause(1)
.send_keys_to_element(pseudo_input,Keys.ENTER)
.perform()
)
finally:
driver.close()
print('DONE!')
Answer the question
In order to leave comments, you need to log in
There can be two reasons.
1. .tiktok-19dw2t5-DivLayoutContainer
looks like a generated style name, it can change at least every time the page is opened.
2. More likely, the bot's account was quietly marked as spam, and now only he sees his messages. Given the actions of the bot, deservedly, most likely.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question