tiktok-uploader: NOT WORK

If I try the bot I get this

`C:\OFFLINEPROJECTS\BOTS\TikTokUploader3\tiktok-uploader>python main.py [14:26:36] ←[92mAuthenticating browser with cookies←[0m [14:26:36] Create a chrome browser instance

DevTools listening on ws://127.0.0.1:54709/devtools/browser/9ad784ab-ac0b-4c0a-b14a-5d935226e733 [14:26:39] Authenticating browser with cookies [18508:11892:0613/142641.430:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [18508:11892:0613/142641.441:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [18508:11892:0613/142641.446:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [18508:11892:0613/142641.559:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -107 [18508:11892:0613/142644.331:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [14:26:44] Posting video.mp4 with description: this is my description [14:26:44] Navigating to upload page [18508:11892:0613/142644.653:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [18508:11892:0613/142646.391:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [18508:11892:0613/142648.184:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [18508:11892:0613/142648.356:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [18508:11892:0613/142648.357:ERROR:socket_manager.cc(141)] Failed to resolve address for stun.l.google.com., errorcode: -105 [18508:11892:0613/142651.351:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [18508:11892:0613/142652.673:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 Created TensorFlow Lite XNNPACK delegate for CPU. [18508:11892:0613/142702.904:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [18508:11892:0613/142702.904:ERROR:ssl_client_socket_impl.cc(879)] handshake failed; returned -1, SSL error code 1, net_error -100 [14:27:47] Failed to upload C:\OFFLINEPROJECTS\BOTS\TikTokUploader3\tiktok-uploader\video.mp4 [14:27:47] Message: Stacktrace: GetHandleVerifier [0x00F0B8E3+45827] (No symbol) [0x00E9DCC4] (No symbol) [0x00D9150F] (No symbol) [0x00DD20BC] (No symbol) [0x00DD216B] (No symbol) [0x00E0E0F2] (No symbol) [0x00DF2E44] (No symbol) [0x00E0C034] (No symbol) [0x00DF2B96] (No symbol) [0x00DC6998] (No symbol) [0x00DC751D] GetHandleVerifier [0x011C4513+2899763] GetHandleVerifier [0x0121793D+3240797] GetHandleVerifier [0x00F913B4+593364] GetHandleVerifier [0x00F982DC+621820] (No symbol) [0x00EA70A4] (No symbol) [0x00EA37A8] (No symbol) [0x00EA3947] (No symbol) [0x00E959FE] BaseThreadInitThunk [0x75FFFCC9+25] RtlGetAppContainerNamedObjectPath [0x770E7CBE+286] RtlGetAppContainerNamedObjectPath [0x770E7C8E+238]`

    there is a way to solve this or this just do not work anymore????

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

@joaovit1 Here it is bro~ I fixed until time_picker_containers, so start from timepicker_hours.

[config.toml]

[selectors.schedule]
switch = "//input[@name='postSchedule' and @value='schedule']"

date_picker = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[2]"
calendar = "//div[contains(@class, 'calendar-wrapper')]"
calendar_month = "//span[contains(@class, 'month-title')]"
calendar_valid_days = "//div[contains(@class, 'days-wrapper')]//span[contains(@class, 'day') and contains(@class, 'valid')]"
calendar_arrows = "//span[contains(@class, 'arrow')]"                                                                            # first last, second next

time_picker = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[1]"
time_picker_text = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[1]"
time_picker_container = "//div[@class='tiktok-timepicker-time-picker-container']"
timepicker_hours = "//span[contains(@class, 'tiktok-timepicker-left')]"
timepicker_minutes = "//span[contains(@class, 'tiktok-timepicker-right')]"

[upload.py]

def _set_schedule_video(driver, schedule: datetime.datetime) -> None:
    """
    Sets the schedule of the video

    Parameters
    ----------
    driver : selenium.webdriver
    schedule : datetime.datetime
        The datetime to set
    """

    logger.debug(green('Setting schedule'))

    driver_timezone = __get_driver_timezone(driver)
    schedule = schedule.astimezone(driver_timezone)

    month = schedule.month
    day = schedule.day
    hour = schedule.hour
    minute = schedule.minute

    try:
        switch = driver.find_element(By.XPATH, config['selectors']['schedule']['switch'])
        print(f"Schedule Switch: {switch}")
        switch.click()
        __date_picker(driver, month, day)
        __time_picker(driver, hour, minute)
    except Exception as e:
        msg = f'Failed to set schedule: {e}'
        logger.error(red(msg))
        raise FailedToUpload()



def __date_picker(driver, month: int, day: int) -> None:
    logger.debug(green('Picking date'))

    condition = EC.presence_of_element_located(
        (By.XPATH, config['selectors']['schedule']['date_picker'])
        )
    date_picker = WebDriverWait(driver, config['implicit_wait']).until(condition)
    date_picker.click()

    print("Date Picker Clicked")

    condition = EC.presence_of_element_located(
        (By.XPATH, config['selectors']['schedule']['calendar'])
    )
    calendar = WebDriverWait(driver, config['implicit_wait']).until(condition)

    calendar_month = driver.find_element(By.XPATH, config['selectors']['schedule']['calendar_month']).text
    n_calendar_month = datetime.datetime.strptime(calendar_month, '%B').month
    if n_calendar_month != month:  # Max can be a month before or after
        if n_calendar_month < month:
            arrow = driver.find_elements(By.XPATH, config['selectors']['schedule']['calendar_arrows'])[-1]
        else:
            arrow = driver.find_elements(By.XPATH, config['selectors']['schedule']['calendar_arrows'])[0]
        arrow.click()
    valid_days = driver.find_elements(By.XPATH, config['selectors']['schedule']['calendar_valid_days'])

    day_to_click = None
    for day_option in valid_days:
        if int(day_option.text) == day:
            day_to_click = day_option
            break
    if day_to_click:
        day_to_click.click()
    else:
        raise Exception('Day not found in calendar')
    __verify_date_picked_is_correct(driver, month, day)


def __verify_date_picked_is_correct(driver, month: int, day: int):
    date_selected = driver.find_element(By.XPATH, config['selectors']['schedule']['date_picker']).get_attribute('value')
    date_selected_month = int(date_selected.split('-')[1])
    date_selected_day = int(date_selected.split('-')[2])

    if date_selected_month == month and date_selected_day == day:
        logger.debug(green('Date picked correctly'))
    else:
        msg = f'Something went wrong with the date picker, expected {month}-{day} but got {date_selected_month}-{date_selected_day}'
        logger.error(msg)
        raise Exception(msg)


def __time_picker(driver, hour: int, minute: int) -> None:
    logger.debug(green('Picking time'))

    condition = EC.presence_of_element_located(
        (By.XPATH, config['selectors']['schedule']['time_picker'])
        )
    time_picker = WebDriverWait(driver, config['implicit_wait']).until(condition)
    time_picker.click()

    condition = EC.presence_of_element_located(
        (By.XPATH, config['selectors']['schedule']['time_picker_container'])
    )
    time_picker_container = WebDriverWait(driver, config['implicit_wait']).until(condition)

    # 00 = 0, 01 = 1, 02 = 2, 03 = 3, 04 = 4, 05 = 5, 06 = 6, 07 = 7, 08 = 8, 09 = 9, 10 = 10, 11 = 11, 12 = 12,
    # 13 = 13, 14 = 14, 15 = 15, 16 = 16, 17 = 17, 18 = 18, 19 = 19, 20 = 20, 21 = 21, 22 = 22, 23 = 23
    hour_options = driver.find_elements(By.XPATH, config['selectors']['schedule']['timepicker_hours'])
    # 00 == 0, 05 == 1, 10 == 2, 15 == 3, 20 == 4, 25 == 5, 30 == 6, 35 == 7, 40 == 8, 45 == 9, 50 == 10, 55 == 11
    minute_options = driver.find_elements(By.XPATH, config['selectors']['schedule']['timepicker_minutes'])

    hour_to_click = hour_options[hour]
    minute_option_correct_index = int(minute / 5)
    minute_to_click = minute_options[minute_option_correct_index]
    
    print(f"Hour to click: {hour_to_click}")
    print(f"Minute to click: {minute_to_click}")

    time.sleep(1) # temporay fix => might be better to use an explicit wait
    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", hour_to_click)
    time.sleep(1) # temporay fix => might be better to use an explicit wait
    hour_to_click.click()

    driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", minute_to_click)
    time.sleep(2) # temporary fixed => Might be better to use an explicit wait
    minute_to_click.click()

    # click somewhere else to close the time picker
    # time_picker.click()

    time.sleep(.5)  # wait for the DOM change
    __verify_time_picked_is_correct(driver, hour, minute)


def __verify_time_picked_is_correct(driver, hour: int, minute: int):
    time_selected = driver.find_element(By.XPATH, config['selectors']['schedule']['time_picker_text']).get_attribute('value')
    time_selected_hour = int(time_selected.split(':')[0])
    time_selected_minute = int(time_selected.split(':')[1])

    if time_selected_hour == hour and time_selected_minute == minute:
        logger.debug(green('Time picked correctly'))
    else:
        msg = f'Something went wrong with the time picker, ' \
              f'expected {hour:02d}:{minute:02d} ' \
              f'but got {time_selected_hour:02d}:{time_selected_minute:02d}'
        raise Exception(msg)

@joaovit1 Here it is bro~ I fixed until time_picker_containers, so start from timepicker_hours.

[selectors.schedule]
switch = "//input[@name='postSchedule' and @value='schedule']"

date_picker = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[2]"
calendar = "//div[contains(@class, 'calendar-wrapper')]"
calendar_month = "//span[contains(@class, 'month-title')]"
calendar_valid_days = "//div[@class='jsx-4172176419 days-wrapper']//span[contains(@class, 'day') and contains(@class, 'valid')]"
calendar_arrows = "//span[contains(@class, 'arrow')]"                                                                            # first last, second next

time_picker = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[1]"
time_picker_text = "(//div[contains(@class, 'TUXTextInput')]/div/div/input[@type='text'])[1]"
time_picker_container = "//div[@class='tiktok-timepicker-time-picker-container']"
timepicker_hours = "//span[contains(@class, 'tiktok-timepicker-left')]"
timepicker_minutes = "//span[contains(@class, 'tiktok-timepicker-right')]"

thank you! I am noob but I will see what I can do!

@MarcoLavoro the main issue related all xpaths of schdule button, date picker, time picker. So, it should takes few hours to fully fix

Additional, switch = “//[@id=‘:r19:’]” this not working becuase the id name be dynamic

wait for a moment. I’ll check it

@MarcoLavoro if you can analyze the xpath using dev console in the chrome, you can solve easily

@MarcoLavoro I don’t know detailed because i had never used the function. but as the logs you write, maybe the issue can be solved by editing config.toml because of xpath.

@MarcoLavoro you’re welcome. be happy day

I don’t solve the issue because i don’t need the function

@MarcoLavoro I fixed the issue and posted pull request. see this #160