Skip to content

Instantly share code, notes, and snippets.

@OndroMih
Created May 16, 2021 11:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OndroMih/17b4593912bc02d9eb98caf99b77ed1d to your computer and use it in GitHub Desktop.
Save OndroMih/17b4593912bc02d9eb98caf99b77ed1d to your computer and use it in GitHub Desktop.
Delete all videos in Tiktok
/*
* 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);
});
})()
@GitHubQueenn
Copy link

Hi, is there a version of this to unlike all videos? I have to go through 20k likes :(

@OndroMih
Copy link
Author

No, I only needed to delete the videos. Feel free to adjust this script for your needs :)

Copy link

ghost commented May 27, 2023

Update??

@OndroMih
Copy link
Author

I'm sorry, I'm not going to update this. I don't use TikTok anymore.

@alejandrade
Copy link

This doesn't work anymore. I wrote a new script that works.

https://gist.github.com/alejandrade/5f2c9bea835b4b80e3fd4532ff2736ad

@OndroMih
Copy link
Author

OndroMih commented Nov 8, 2023

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.

@aixn881314
Copy link

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