[Python] Unmark video as saved in TikTok with Python and Selenium

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I've been messing around with Python + Selenium for a few days now to download all my saved TikTok videos (not the same as favourite).

    Now that I have them downloaded, I'm trying to make another Python script that accesses my saved videos and unbookmarks them (this is the same as unbookmarking them).

    I've even clicked the button with:

    def desmarcar_favorito(url, es_primera=False):
    try:
    driver.get(url)
    sleep(10 if es_primera else 2)

    botones = driver.find_elements(By.CSS_SELECTOR, "button.css-rninf8-ButtonActionItem.edu4zum0")
    if len(botones) < 3:
    raise Exception("No se encontraron suficientes botones (esperado al menos 3).")

    boton_fav = botones[2] # Tercer botón = favorito
    wait.until(EC.element_to_be_clickable(boton_fav)).click()

    sleep(15)

    except Exception as e:
    print(f"Error con {url}: {e}")
    traceback.print_exc()


    But even though the icon turns from yellow to white, when I go back to my saved videos the video is still there. I've even added a timeout in case TikTok doesn't do the action at the time.

    Any idea how to press the button and check that it has actually removed it?

    Continue reading...

Compartilhe esta Página