Pricing
$10.00/month + usage
Tiktok video downloader
Download TikTok videos in bulk and save to Apify Key value store
Pricing
$10.00/month + usage
Rating
2.8
(2)
Developer
Actor stats
1
Bookmarked
531
Total users
4
Monthly active users
a year ago
Last modified
Categories
Share
Download multiple public tiktok videos in parallel to the Apify Key Value store.
Supported URLs
https://www.tiktok.com/@username/video/...
Custom data
If you need to pass custom data to the output, set the userData object of the request in the startUrls array and it will be appended to the output
{"startUrls":[{"url":"https://www.tiktok.com/@.../video/...","userData":{"userid":"6236572396729"}}]}
Integration
Integrates with the https://apify.com/pocesar/merge-key-value-store-pieces to merge the output as one output for each chunks downloaded. Otherwise, check the way for doing this manually below.
Output
The generated output is the following:
{"url": "https://www.tiktok.com/@khaby.lame/video/7211630755884043525", // original URL requested"hash": "1e0ef015", // the internal hash of the video, never changes between requests"partsUrl": "https://api.apify.com/v2/key-value-stores/SOME_ID/records/1e0ef015", // the URL to the Key Value store where the video parts are stored"userData": {"userid": "6236572396729"},"#error": false // hidden field if there was an error}
The video is chunked in parts of ~2MB each and saved to the Key Value store. To be able to download it, you'll need to download all the parts and concatenate them together. Here's a small example that can be used in the browser:
const{ appendFileSync }=require('node:fs');asyncfunctionmain(datasetId){const items =awaitfetch(`https://api.apify.com/v2/datasets/${datasetId}/items?clean=true&format=json`).then((response)=> response.json());const firstVideo = items[0].partsUrl;// partsUrl contains the location to the Key Value store// get the parts from the Key value storeconst{ parts, length, contentType }=awaitfetch(firstVideo).then((response)=> response.json());console.log({ parts, length, contentType });// wait for all parts to be downloadedfor(const url of parts){// download part using fetchconst downloaded =awaitfetch(url);// get an arrayBuffer from the chunkconst arrayBuffer =newUint8Array(await downloaded.arrayBuffer());console.log(`Downloaded ${arrayBuffer.byteLength} bytes from ${url}`);// write downloaded chunk to fileappendFileSync('video.mp4', arrayBuffer);}}main('YOUR_DATASET_ID');
