-
-
Save alejandrade/5f2c9bea835b4b80e3fd4532ff2736ad to your computer and use it in GitHub Desktop.
/* | |
A script to delete all videos from a Tittok account | |
Learn how to delete all TikTok videos programmatically with this JavaScript script. | |
This script triggers hover events, clicks "Delete" buttons, and automates the video deletion process. | |
1. go to your latest video and paste this entire script in the terminal. | |
2. wait until all videos are deleted one by one | |
This script will programatically click the delete button on your videos one by one. | |
*/ | |
function triggerHoverEvent(element) { | |
const hoverEvent = new MouseEvent('mouseover', { | |
bubbles: true, | |
cancelable: true, | |
view: window, | |
}); | |
element.dispatchEvent(hoverEvent); | |
} | |
function clickDeleteButtonInLI() { | |
const liElements = document.querySelectorAll('li[data-e2e="video-delete"]'); | |
for (const liElement of liElements) { | |
const deleteButton = liElement.querySelector('button'); | |
if (deleteButton && deleteButton.textContent.trim() === 'Delete') { | |
deleteButton.click(); | |
setTimeout(() => { | |
const modalDeleteButton = document.querySelector('[data-e2e="video-modal-delete"]'); | |
if (modalDeleteButton) { | |
modalDeleteButton.click(); | |
} | |
}, 200); // Wait 200 milliseconds after clicking "Delete" button | |
return; // Exit the loop after the first successful click | |
} | |
} | |
} | |
function performVideoDeletion() { | |
const targetElement = document.querySelector('[data-e2e="video-setting"]'); | |
if (targetElement) { | |
triggerHoverEvent(targetElement); | |
setTimeout(clickDeleteButtonInLI, 2000); // Adjust the initial delay as needed (2 seconds in this case) | |
setTimeout(() => { | |
performVideoDeletion(); // Recursively call the function after a 3-second delay | |
}, 3000); // Wait 3 seconds before performing the next operation | |
} else { | |
console.log("No more elements found. Stopping."); | |
} | |
} | |
// Start the process | |
performVideoDeletion(); |
How to us this file
How to us this file
Read the comments
tiktok archive all videos script:
`
/*
A script to archive all videos from a TikTok account by setting privacy to "Only Me".
- Go to your latest video and paste this entire script in the terminal.
- Wait until all videos are archived one by one.
This script will programmatically change the privacy setting on your videos to "Only Me" one by one.
*/
function triggerHoverEvent(element) {
const hoverEvent = new MouseEvent('mouseover', {
bubbles: true,
cancelable: true,
view: window,
});
element.dispatchEvent(hoverEvent);
}
function clickPrivacySettingInLI() {
const liElements = document.querySelectorAll('li[data-e2e="video-privacy-settings"]');
for (const liElement of liElements) {
const privacyButton = liElement.querySelector('button');
if (privacyButton) {
privacyButton.click();
setTimeout(() => {
const privacySelect = document.querySelector('[data-e2e="video-setting-choose"]');
if (privacySelect) {
privacySelect.click();
setTimeout(() => {
const options = document.querySelectorAll('ul.css-odugpm-UlOptionsContainer li');
for (const option of options) {
if (option.textContent.trim() === 'Somente você') {
option.click();
setTimeout(() => {
const saveButton = document.querySelector('[data-e2e="video-setting-down"]');
if (saveButton) {
saveButton.click();
}
// Passa para o próximo vídeo
setTimeout(() => {
const nextButton = document.querySelector('button[data-e2e="arrow-right"]');
if (nextButton) {
nextButton.click();
}
}, 500); // Tempo de espera de 500ms após salvar a configuração
}, 200); // Tempo de espera de 200ms após selecionar "Somente você"
return true; // Retorna true após a alteração bem-sucedida da privacidade
}
}
}, 200); // Tempo de espera de 200ms após abrir as opções de privacidade
}
}, 500); // Tempo de espera de 500ms após clicar no botão de privacidade
return true; // Retorna true após uma alteração de privacidade bem-sucedida
}
}
return false; // Retorna false se nenhuma alteração de privacidade for realizada
}
function performVideoArchiving(maxAttempts = 50) {
if (maxAttempts <= 0) {
console.log("Reached maximum attempts. Stopping.");
return;
}
const targetElement = document.querySelector('[data-e2e="video-setting"]');
if (targetElement) {
triggerHoverEvent(targetElement);
setTimeout(() => {
const archivingSuccess = clickPrivacySettingInLI();
if (archivingSuccess) {
setTimeout(() => {
performVideoArchiving(maxAttempts - 1); // Chama recursivamente a função após um intervalo de 3 segundos
}, 3000); // Espera 3 segundos antes de realizar a próxima operação
} else {
console.log("No privacy setting found. Stopping.");
}
}, 2000); // Atraso inicial (2 segundos) antes de tentar arquivar
} else {
console.log("No more elements found. Stopping.");
}
}
// Inicia o processo com um máximo de 50 tentativas
performVideoArchiving();
`
hi if I change the script a little can this work for removing all your repost ?
I was thinking the same thing. So did it work ?
hi if I change the script a little can this work for removing all your repost ?