Created
May 16, 2021 11:35
-
-
Save OndroMih/17b4593912bc02d9eb98caf99b77ed1d to your computer and use it in GitHub Desktop.
Delete all videos in Tiktok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A script to delete all videos from a Tittok account | |
* | |
* Before running: | |
* 1. Log into your Tiktok account in a browser (tested with Firefox) | |
* 2. Navigate to the View Profile | |
* 3. Open the developer tools in the browser to inspect the URLs of the requests (Network tab in Firefox) | |
* 4. Click on one of the videos and delete it | |
* 5. In the developer tools, find the last POST request with a URL that starts with https://m.tiktok.com/api/aweme/delete | |
* 6. Copy the URL into the script below into the line that starts with 'const url'. Replace the value of aweme_id and target with: " + id + " | |
* 7. Navigate back to the VIew Profile page | |
* 8. Open developer tools and copy the script below into the Javascript console | |
* 9. Run the script several times until all the videos are deleted | |
* (each time you run it, it will only delete the videos showed on the page and reload the page) | |
*/ | |
(() => { | |
let es = | |
document.querySelectorAll(".video-feed-item-wrapper"); | |
console.log("es length: " + es.length); | |
let promises = []; | |
es.forEach( | |
e => { | |
const parts = e.href.split("/"); | |
const id = parts[parts.length-1] | |
const options = { | |
method: 'POST', | |
credentials: 'include' | |
} | |
const url = "begining of the URL" + "6&aweme_id=" + id + "&target=" + id + "end of the URL"; | |
// console.log(url); | |
promises.push(fetch(url, options)); | |
} | |
); | |
Promise.all(promises) | |
.then( vs => { | |
console.log("All done, reloading the page!"); | |
window.location.reload(true); | |
}); | |
})() |
Update??
I'm sorry, I'm not going to update this. I don't use TikTok anymore.
This doesn't work anymore. I wrote a new script that works.
https://gist.github.com/alejandrade/5f2c9bea835b4b80e3fd4532ff2736ad
Awesome, @alejandrade !
I don’t use Tiktok anymore, so I’m not going to update this script or write any new Tiktok scripts. But I’m glad that it helped others in the past and now you shared a new script that will help others too.
Can you provide a query for all video data under the TikTok username? I need an API
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, I only needed to delete the videos. Feel free to adjust this script for your needs :)