wkaisertexas / tiktok-uploader

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

Anyone have any ideas? Stacktrace with Google Chrome #93

Closed devQA-0007 closed 7 months ago

devQA-0007 commented 8 months ago

Unfortunately you can no longer upload videos via tiktok-uploader and Google Chrome, the extension is no longer usable, does anyone have an idea what to do?

`[14:40:40] Authenticating browser with cookies [14:40:40] Uploading 2 videos [14:40:40] Create a chrome browser instance [14:40:42] Authenticating browser with cookies [14:40:45] Posting C:\Users\Development\python\src\mp4\status_6397922bb359f7e48a58cc303bf630f6.mp4 with description: Beschreibung [14:40:45] Navigating to upload page [14:40:47] Uploading video file ...1 ....2 .....3 .....4 Message: Stacktrace: GetHandleVerifier [0x01266EE3+174339] (No symbol) [0x01190A51] (No symbol) [0x00EA6FF6] (No symbol) [0x00ED9876] (No symbol) [0x00ED9C2C] (No symbol) [0x00F0BD42] (No symbol) [0x00EF7054] (No symbol) [0x00F0A104] (No symbol) [0x00EF6DA6] (No symbol) [0x00ED1034] (No symbol) [0x00ED1F8D] GetHandleVerifier [0x01304B1C+820540] sqlite3_dbdata_init [0x013C53EE+653550] sqlite3_dbdata_init [0x013C4E09+652041] sqlite3_dbdata_init [0x013B97CC+605388] sqlite3_dbdata_init [0x013C5D9B+656027] (No symbol) [0x0119FE6C] (No symbol) [0x011983B8] (No symbol) [0x011984DD] (No symbol) [0x01185818] BaseThreadInitThunk [0x76907BA9+25] RtlInitializeExceptionChain [0x77A7BD2B+107] RtlClearBits [0x77A7BCAF+191]

Message: Stacktrace: GetHandleVerifier [0x01266EE3+174339] (No symbol) [0x01190A51] (No symbol) [0x00EA6FF6] (No symbol) [0x00ED9876] (No symbol) [0x00ED9C2C] (No symbol) [0x00F0BD42] (No symbol) [0x00EF7054] (No symbol) [0x00F0A104] (No symbol) [0x00EF6DA6] (No symbol) [0x00ED1034] (No symbol) [0x00ED1F8D] GetHandleVerifier [0x01304B1C+820540] sqlite3_dbdata_init [0x013C53EE+653550] sqlite3_dbdata_init [0x013C4E09+652041] sqlite3_dbdata_init [0x013B97CC+605388] sqlite3_dbdata_init [0x013C5D9B+656027] (No symbol) [0x0119FE6C] (No symbol) [0x011983B8] (No symbol) [0x011984DD] (No symbol) [0x01185818] BaseThreadInitThunk [0x76907BA9+25] RtlInitializeExceptionChain [0x77A7BD2B+107] RtlClearBits [0x77A7BCAF+191]

[14:46:51] Failed to upload C:\Users\Development\python\src\mp4\status_6397922bb359f7e48a58cc303bf630f6.mp4 [14:46:51] A video failed to upload`

momeir commented 8 months ago

I have the same issue.

andrewCohn commented 8 months ago

chrome is broken ATM. Try compiling the library yourself from this fork which uses firefox instead:

https://github.com/andrewCohn/tiktok-uploader

I submit a PR (#92) that addresses this, waiting for the maintainer to merge.

momeir commented 8 months ago

I don't understand, I have to insall it ?

andrewCohn commented 8 months ago

I don't understand, I have to insall it ?

yeah, clone the repo, build with hatch, then install the library with pip per the install instructions

cristid9 commented 8 months ago

I don't understand, I have to insall it ?

yeah, clone the repo, build with hatch, then install the library with pip per the install instructions

I get this error when trying to use the patch from that repo

[01:45:50] Navigating to upload page
[01:45:51] Uploading video file
[01:46:00] Video should be uploading
[01:46:00] Video should be uploaded
[01:46:00] Upload Confirmed
[01:46:00] Setting interactivity settings
[01:46:05] Failed to set interactivity settings
[01:46:05] Setting description
[01:46:34] Setting description
[01:46:34] Clicking the post button
[01:46:40] Unhandled Exception!
Message: 
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16

The upload button seems to have a new xpath now: /html/body/div[1]/div/div/div/div/div[2]/div[2]/div[6]/div[2]/button/div/div, but even with this one it throws the same error

romanrsr commented 8 months ago

I don't understand, I have to insall it ?

yeah, clone the repo, build with hatch, then install the library with pip per the install instructions

I get this error when trying to use the patch from that repo

[01:45:50] Navigating to upload page
[01:45:51] Uploading video file
[01:46:00] Video should be uploading
[01:46:00] Video should be uploaded
[01:46:00] Upload Confirmed
[01:46:00] Setting interactivity settings
[01:46:05] Failed to set interactivity settings
[01:46:05] Setting description
[01:46:34] Setting description
[01:46:34] Clicking the post button
[01:46:40] Unhandled Exception!
Message: 
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16

The upload button seems to have a new xpath now: /html/body/div[1]/div/div/div/div/div[2]/div[2]/div[6]/div[2]/button/div/div, but even with this one it throws the same error

Same here

cristid9 commented 8 months ago

I don't understand, I have to insall it ?

yeah, clone the repo, build with hatch, then install the library with pip per the install instructions

I get this error when trying to use the patch from that repo

[01:45:50] Navigating to upload page
[01:45:51] Uploading video file
[01:46:00] Video should be uploading
[01:46:00] Video should be uploaded
[01:46:00] Upload Confirmed
[01:46:00] Setting interactivity settings
[01:46:05] Failed to set interactivity settings
[01:46:05] Setting description
[01:46:34] Setting description
[01:46:34] Clicking the post button
[01:46:40] Unhandled Exception!
Message: 
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16

The upload button seems to have a new xpath now: /html/body/div[1]/div/div/div/div/div[2]/div[2]/div[6]/div[2]/button/div/div, but even with this one it throws the same error

Same here

This version of _post_video in upload.py seems to work for me:

def _post_video(driver) -> None:
    """
    Posts the video by clicking the post button

    Parameters
    ----------
    driver : selenium.webdriver
    """
    logger.debug(green('Clicking the post button'))

    driver.set_window_size(1920, 1080)

    try:

        post_button_xpath = config['selectors']['upload']['post']

        # Find the button element

        logger.debug(EC.element_to_be_clickable((By.XPATH, "/html/body/div[1]/div/div/div/div/div[2]/div[2]/div[6]/div[2]/button")))
        post_button = WebDriverWait(driver, config['implicit_wait']).until(
            EC.element_to_be_clickable((By.XPATH, "/html/body/div[1]/div/div/div/div/div[2]/div[2]/div[6]/div[2]/button"))
        )
        logger.debug(green('Houston, we have a click button (element is clickable)'))

        # Click the button or submit the form, depending on your use case
        # post_button.click() THIS DOESN'T WORK ANYMORE FOR SOME REASON
        driver.execute_script('document.querySelector(".btn-post > button").click()')
        logger.debug(green('The click has occurred'))

    except ElementClickInterceptedException:
        logger.debug(green("Trying to click on the button again"))
        driver.execute_script('document.querySelector(".btn-post > button").click()')
    except Exception as e:
        logger.debug(red('Unhandled Exception!'))
        print(e)

    post_confirmation = EC.visibility_of_element_located(
        (By.XPATH, "/html/body/div[4]/div[2]/div/div/div/div/div[2]/div/button[2]/div")
        )

    manage_posts = WebDriverWait(driver, config['explicit_wait']).until(post_confirmation)
    manage_posts.click()

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

I used hardcoded xpaths to get through it quicker, but even though this is the log:

[16:12:15] Navigating to upload page
[16:12:16] Uploading video file
[16:12:24] Video should be uploading
[16:12:24] Video should be uploaded
[16:12:24] Upload Confirmed
[16:12:24] Setting interactivity settings
[16:12:54] Failed to set interactivity settings
[16:12:54] Setting description
[16:15:58] Setting description
[16:15:58] Clicking the post button
[16:15:58] Houston, we have a click button (element is clickable)
[16:15:58] The click has occurred
[16:16:18] Video posted successfully

When going to the posts page on tiktok, the video is not there.

Edit: after switching back to chromedriver with the new xpaths seems to be working, it posts the video, even though it issues some stacktrace related to chromedriver at the end.

gavink97 commented 8 months ago

After manage_posts is clicked TikTok will full page reload while navigating to the posts page. I believe if it doesn't load completely the video won't appear; although I've also noticed TikTok just not upload the video.

yuuval commented 8 months ago

Hi, is this fixed by now on the main branch? @andrewCohn @wkaisertexas

Paillat-dev commented 7 months ago

Why was this closed @wkaisertexas ?