If you're shutting down your TikTok account or you simply want a copy of all the videos you've published, TikTok has a process where you can request your data and then download it. However, the process is a bit arduous (perhaps on purpose) as you have to first request the download, wait a few days, then make sure you download it before it expires. Then, once you've downloaded the file, you realize it only contains single-use links to download the actual videos. If you have a lot of videos, the process of downloading each can be very time-consuming.
I've written a simple Node.js script that automates the process. Here's how to use it:
-
Make sure you have Node.js installed on your computer
-
Go through the process with TikTok to request and download your data file (you can Google how to do this)
-
Unzip the resulting data file from TikTok
-
Download the
index.js
andpackage.json
files included in this gist and move them into a separate folder (eg.~/Downloads/download-tiktok
) -
Run this command once to install the Node dependencies used by the script:
npm install
-
Get the path to the
Videos.txt
file contained within the TikTok download folder that was created when the TikTok zip file was unzipped -
Run the script from the command line:
nonde index.js PATH_TO_THE_VIDEOS_TXT_FILE
The script will download each video and create .mp4
files in the same directory as the script with integer names:
0.mp4
1.mp4
2.mp4
...