wkaisertexas / tiktok-uploader

Automatically ⬆️ upload TikTok videos
https://pypi.org/project/tiktok-uploader/
360 stars 84 forks source link

Failed to upload #138

Closed wdoer closed 4 months ago

wdoer commented 4 months ago

Anyone know how to fix it?

[12:00:33] Clicking the post button
[12:00:39] Failed to upload path/videos/video0.mp4
[12:00:39] Message: 
Stacktrace:
0   chromedriver                        0x00000001004e2924 chromedriver + 4368676
1   chromedriver                        0x00000001004dadb8 chromedriver + 4337080
2   chromedriver                        0x00000001000fec04 chromedriver + 289796
3   chromedriver                        0x0000000100140e00 chromedriver + 560640
4   chromedriver                        0x00000001001795ec chromedriver + 792044
5   chromedriver                        0x0000000100135ab4 chromedriver + 514740
6   chromedriver                        0x000000010013650c chromedriver + 517388
7   chromedriver                        0x00000001004a6e40 chromedriver + 4124224
8   chromedriver                        0x00000001004abc30 chromedriver + 4144176
9   chromedriver                        0x000000010048c808 chromedriver + 4016136
10  chromedriver                        0x00000001004ac560 chromedriver + 4146528
11  chromedriver                        0x000000010047e2bc chromedriver + 3957436
12  chromedriver                        0x00000001004cbea8 chromedriver + 4275880
13  chromedriver                        0x00000001004cc024 chromedriver + 4276260
14  chromedriver                        0x00000001004daa18 chromedriver + 4336152
15  libsystem_pthread.dylib             0x000000018c46a034 _pthread_start + 136
16  libsystem_pthread.dylib             0x000000018c464e3c thread_start + 8

-------------------------
Error while uploading video
-------------------------
johnongit commented 4 months ago

I have the same thing on pop os 22.04 (ubuntu like)

tonysmiles commented 4 months ago

Maybe tiktok changed the html structure, this morning I still uploaded successfully, but this afternoon everything changed, a similar error message, it needs to be updated soon

RomanStartov commented 4 months ago

Maybe tiktok changed the html structure, this morning I still uploaded successfully, but this afternoon everything changed, a similar error message, it needs to be updated soon

Hi, I'm creating a similar automation for my personal purposes that works through the antidetect browser. I came across the fact that after publication, the video automatically gets banned. Have you encountered this problem using this solution?

I solved this using a script that animates a virtual cursor and clicks on a button. And this worked for some time, but now it again issues bans for videos.

    parent_element = WebDriverWait(driver, 100).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".jsx-3457533826.btn-post"))
    )
    post = parent_element.find_element(By.XPATH, "./button/div/div")
    time.sleep(7)
    driver.execute_script("arguments[0].scrollIntoView(true);", post)
    time.sleep(4)
    driver.execute_script('virtualCursor.moveTo(arguments[0]);', post)
    time.sleep(3)
    driver.execute_script('virtualCursor.click(arguments[0]);', post)
tonysmiles commented 4 months ago

Maybe tiktok changed the html structure, this morning I still uploaded successfully, but this afternoon everything changed, a similar error message, it needs to be updated soon

Hi, I'm creating a similar automation for my personal purposes that works through the antidetect browser. I came across the fact that after publication, the video automatically gets banned. Have you encountered this problem using this solution?

I solved this using a script that animates a virtual cursor and clicks on a button. And this worked for some time, but now it again issues bans for videos.

    parent_element = WebDriverWait(driver, 100).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".jsx-3457533826.btn-post"))
    )
    post = parent_element.find_element(By.XPATH, "./button/div/div")
    time.sleep(7)
    driver.execute_script("arguments[0].scrollIntoView(true);", post)
    time.sleep(4)
    driver.execute_script('virtualCursor.moveTo(arguments[0]);', post)
    time.sleep(3)
    driver.execute_script('virtualCursor.click(arguments[0]);', post)

I solved it in my own way logger.debug(green('Clicking the post button'))

try:
    # Updated selector to use XPath and text-based selection
    post_button_xpath = "//button[.//div[contains(text(), 'Post')]]"
    post = WebDriverWait(driver, config['implicit_wait']).until(EC.element_to_be_clickable((By.XPATH, post_button_xpath)))
    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", post)
    post.click()
except ElementClickInterceptedException:
    logger.debug(green("Trying to click on the button again"))
    # Fallback click using JavaScript and the new selector
    driver.execute_script('document.evaluate("//button[.//div[contains(text(), \'Post\')]]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();')

# Update the XPath for the confirmation message
post_confirmation_xpath = "//div[contains(text(), 'Your video has been uploaded')]"
post_confirmation = EC.presence_of_element_located((By.XPATH, post_confirmation_xpath))
WebDriverWait(driver, config['explicit_wait']).until(post_confirmation)

logger.debug(green('Video posted successfully'))
RomanStartov commented 4 months ago

Возможно тикток поменял структуру html, сегодня утром еще успешно залил, но сегодня днём всё поменялось, похожее сообщение об ошибке, надо скоро обновить

Привет, я создаю подобную автоматику для своих личных целей, которая работает через браузер-антидетект. Столкнулся с тем, что после публикации видео автоматически попадает в бан. Сталкивались ли вы с этой проблемой, используя это решение? Я решил это с помощью скрипта, который анимирует виртуальный курсор и нажимает кнопку. И какое-то время это работало, но сейчас снова выдает баны за видео.

    parent_element = WebDriverWait(driver, 100).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".jsx-3457533826.btn-post"))
    )
    post = parent_element.find_element(By.XPATH, "./button/div/div")
    time.sleep(7)
    driver.execute_script("arguments[0].scrollIntoView(true);", post)
    time.sleep(4)
    driver.execute_script('virtualCursor.moveTo(arguments[0]);', post)
    time.sleep(3)
    driver.execute_script('virtualCursor.click(arguments[0]);', post)

Я решил это по-своему logger.debug(green('Нажатие кнопки публикации'))

try:
    # Updated selector to use XPath and text-based selection
    post_button_xpath = "//button[.//div[contains(text(), 'Post')]]"
    post = WebDriverWait(driver, config['implicit_wait']).until(EC.element_to_be_clickable((By.XPATH, post_button_xpath)))
    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", post)
    post.click()
except ElementClickInterceptedException:
    logger.debug(green("Trying to click on the button again"))
    # Fallback click using JavaScript and the new selector
    driver.execute_script('document.evaluate("//button[.//div[contains(text(), \'Post\')]]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();')

# Update the XPath for the confirmation message
post_confirmation_xpath = "//div[contains(text(), 'Your video has been uploaded')]"
post_confirmation = EC.presence_of_element_located((By.XPATH, post_confirmation_xpath))
WebDriverWait(driver, config['explicit_wait']).until(post_confirmation)

logger.debug(green('Video posted successfully'))

Thanks for the answer, yes, I also initially tried this method. But unfortunately it does not solve the problem. I literally take one account and upload a video to it manually and it works, then I try to upload it through automation and it gets instantly banned. I noticed that this doesn't work for all accounts. For example: If you take several newly registered accounts and start uploading videos on them, absolutely everyone will receive a ban. But after the second attempt to upload the video, only some of them get banned. That is, it turns out that there is a difference in the quality of accounts. But if you take those accounts that always get banned when automatically uploading videos, and manually upload videos to them. Then everything works and the videos don’t get banned. The scheme is complex and I suspect that there is some kind of identifier for “untrusted” accounts that turns on and detects auto-posting. However, if you click on the button with a real mouse, this identifier accepts video. As a result, I want to somehow get around this problem and I suspect that I need to use a real mouse and a real click, but I haven’t succeeded yet. I understand this is a complex scheme. And sorry for my English, it's all Google Translate))

tonysmiles commented 4 months ago

Возможно тикток поменял структуру html, сегодня утром еще успешно залил, но сегодня днём всё поменялось, похожее сообщение об ошибке, надо скоро обновить

Привет, я создаю подобную автоматику для своих личных целей, которая работает через браузер-антидетект. Столкнулся с тем, что после публикации видео автоматически попадает в бан. Сталкивались ли вы с этой проблемой, используя это решение? Я решил это с помощью скрипта, который анимирует виртуальный курсор и нажимает кнопку. И какое-то время это работало, но сейчас снова выдает баны за видео.

    parent_element = WebDriverWait(driver, 100).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".jsx-3457533826.btn-post"))
    )
    post = parent_element.find_element(By.XPATH, "./button/div/div")
    time.sleep(7)
    driver.execute_script("arguments[0].scrollIntoView(true);", post)
    time.sleep(4)
    driver.execute_script('virtualCursor.moveTo(arguments[0]);', post)
    time.sleep(3)
    driver.execute_script('virtualCursor.click(arguments[0]);', post)

Я решил это по-своему logger.debug(green('Нажатие кнопки публикации'))

try:
    # Updated selector to use XPath and text-based selection
    post_button_xpath = "//button[.//div[contains(text(), 'Post')]]"
    post = WebDriverWait(driver, config['implicit_wait']).until(EC.element_to_be_clickable((By.XPATH, post_button_xpath)))
    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", post)
    post.click()
except ElementClickInterceptedException:
    logger.debug(green("Trying to click on the button again"))
    # Fallback click using JavaScript and the new selector
    driver.execute_script('document.evaluate("//button[.//div[contains(text(), \'Post\')]]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();')

# Update the XPath for the confirmation message
post_confirmation_xpath = "//div[contains(text(), 'Your video has been uploaded')]"
post_confirmation = EC.presence_of_element_located((By.XPATH, post_confirmation_xpath))
WebDriverWait(driver, config['explicit_wait']).until(post_confirmation)

logger.debug(green('Video posted successfully'))

Thanks for the answer, yes, I also initially tried this method. But unfortunately it does not solve the problem. I literally take one account and upload a video to it manually and it works, then I try to upload it through automation and it gets instantly banned. I noticed that this doesn't work for all accounts. For example: If you take several newly registered accounts and start uploading videos on them, absolutely everyone will receive a ban. But after the second attempt to upload the video, only some of them get banned. That is, it turns out that there is a difference in the quality of accounts. But if you take those accounts that always get banned when automatically uploading videos, and manually upload videos to them. Then everything works and the videos don’t get banned. The scheme is complex and I suspect that there is some kind of identifier for “untrusted” accounts that turns on and detects auto-posting. However, if you click on the button with a real mouse, this identifier accepts video. As a result, I want to somehow get around this problem and I suspect that I need to use a real mouse and a real click, but I haven’t succeeded yet. I understand this is a complex scheme. And sorry for my English, it's all Google Translate))

I haven't tried it with new accounts, but my old accounts work normally. I will test the newly created accounts. If there is a problem like you said, I will find the cause to fix it.

wdoer commented 4 months ago

Возможно тикток поменял структуру html, сегодня утром еще успешно залил, но сегодня днём всё поменялось, похожее сообщение об ошибке, надо скоро обновить

Привет, я создаю подобную автоматику для своих личных целей, которая работает через браузер-антидетект. Столкнулся с тем, что после публикации видео автоматически попадает в бан. Сталкивались ли вы с этой проблемой, используя это решение? Я решил это с помощью скрипта, который анимирует виртуальный курсор и нажимает кнопку. И какое-то время это работало, но сейчас снова выдает баны за видео.

    parent_element = WebDriverWait(driver, 100).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".jsx-3457533826.btn-post"))
    )
    post = parent_element.find_element(By.XPATH, "./button/div/div")
    time.sleep(7)
    driver.execute_script("arguments[0].scrollIntoView(true);", post)
    time.sleep(4)
    driver.execute_script('virtualCursor.moveTo(arguments[0]);', post)
    time.sleep(3)
    driver.execute_script('virtualCursor.click(arguments[0]);', post)

Я решил это по-своему logger.debug(green('Нажатие кнопки публикации'))

try:
    # Updated selector to use XPath and text-based selection
    post_button_xpath = "//button[.//div[contains(text(), 'Post')]]"
    post = WebDriverWait(driver, config['implicit_wait']).until(EC.element_to_be_clickable((By.XPATH, post_button_xpath)))
    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", post)
    post.click()
except ElementClickInterceptedException:
    logger.debug(green("Trying to click on the button again"))
    # Fallback click using JavaScript and the new selector
    driver.execute_script('document.evaluate("//button[.//div[contains(text(), \'Post\')]]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();')

# Update the XPath for the confirmation message
post_confirmation_xpath = "//div[contains(text(), 'Your video has been uploaded')]"
post_confirmation = EC.presence_of_element_located((By.XPATH, post_confirmation_xpath))
WebDriverWait(driver, config['explicit_wait']).until(post_confirmation)

logger.debug(green('Video posted successfully'))

Thanks for the answer, yes, I also initially tried this method. But unfortunately it does not solve the problem. I literally take one account and upload a video to it manually and it works, then I try to upload it through automation and it gets instantly banned. I noticed that this doesn't work for all accounts. For example: If you take several newly registered accounts and start uploading videos on them, absolutely everyone will receive a ban. But after the second attempt to upload the video, only some of them get banned. That is, it turns out that there is a difference in the quality of accounts. But if you take those accounts that always get banned when automatically uploading videos, and manually upload videos to them. Then everything works and the videos don’t get banned. The scheme is complex and I suspect that there is some kind of identifier for “untrusted” accounts that turns on and detects auto-posting. However, if you click on the button with a real mouse, this identifier accepts video. As a result, I want to somehow get around this problem and I suspect that I need to use a real mouse and a real click, but I haven’t succeeded yet. I understand this is a complex scheme. And sorry for my English, it's all Google Translate))

I haven't tried it with new accounts, but my old accounts work normally. I will test the newly created accounts. If there is a problem like you said, I will find the cause to fix it.

guys go discuss in new issue you problem, please

callumjamesfortune commented 4 months ago

@johnongit @wdoer @tonysmiles @RomanStartov @csrgxtu This PR should fix the failing to post issue, please be aware this won't fix scheduling for the time being.

PR: https://github.com/wkaisertexas/tiktok-uploader/pull/141

wdoer commented 4 months ago

@johnongit @wdoer @tonysmiles @RomanStartov @csrgxtu This PR should fix the failing to post issue, please be aware this won't fix scheduling for the time being.

PR: #141

Thank you very much for taking the time to do this, all good working!