Skip to Content
Mika Scraper 1.1.1 is released ๐ŸŽ‰

Function: downloadTikTok()

downloadTikTok(tiktokUrl, retryOptions): Promise<TikTokResult>

Defined in: src/downloader/tiktok.ts:88

Downloads content from TikTok using the tmate.cc service by providing a specific video or image URL. This function is particularly useful for automating the retrieval of TikTok media for further processing or analysis.

Parameters

tiktokUrl

string
The full URL of the TikTok video or image post. This parameter must be a valid TikTok link.

retryOptions

RetryOptions (default: { retries: 3, delayMs: 1000 })
An object to specify the retry behavior for failed requests. The default configuration allows up to 3 retries with a 1000 milliseconds delay between attempts.

Returns

Promise<TikTokResult>
A promise that resolves with a TikTokResult object, which includes links to the video, image, or audio content retrieved from the provided TikTok URL.

Throws

Throws an error if the authentication token, HTML content, or links are missing or invalid. It is advisable to handle these exceptions to ensure robust application behavior.

Example

import { downloadTikTok } from 'mika-scraper'; const url = 'https://www.tiktok.com/@username/video/123456789'; const options = { retries: 5, delayMs: 2000 }; downloadTikTok(url, options) .then(result => { console.log('Downloaded TikTok content:', result); }) .catch(error => { console.error('Error downloading TikTok content:', error); });
Last updated on