| Crates.io | rtkd |
| lib.rs | rtkd |
| version | 0.1.0 |
| created_at | 2025-05-21 12:10:20.822493+00 |
| updated_at | 2025-05-21 12:10:20.822493+00 |
| description | A minimalistic library for downloading TikTok videos |
| homepage | |
| repository | https://github.com/Icytank/rtkd |
| max_upload_size | |
| id | 1683332 |
| size | 70,381 |
A minimal and flexible Rust library for downloading TikTok videos.
Add this to your Cargo.toml:
[dependencies]
rtkd = "0.1.0"
use rtkd::TikTokDownloader;
use std::path::Path;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize the downloader with required cookie
let downloader = TikTokDownloader::builder()
.with_cookie("your_tiktok_cookie_here")
.build()?;
// Download a TikTok video
downloader.download_video(
"https://www.tiktok.com/@username/video/1234567890123456789",
"/path/to/save/video.mp4",
).await?;
Ok(())
}
You can customize the HTTP headers used for requests:
use rtkd::TikTokDownloader;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Custom headers
let mut headers = HashMap::new();
headers.insert("User-Agent".to_string(), "Your custom user agent".to_string());
let downloader = TikTokDownloader::builder()
.with_cookie("your_tiktok_cookie_here")
.with_headers(headers)
.build()?;
// Download a TikTok video
downloader.download_video(
"https://www.tiktok.com/@username/video/1234567890123456789",
"/path/to/save/video.mp4",
).await?;
Ok(())
}
This project is licensed under the MIT License.