rtkd

Crates.iortkd
lib.rsrtkd
version0.1.0
created_at2025-05-21 12:10:20.822493+00
updated_at2025-05-21 12:10:20.822493+00
descriptionA minimalistic library for downloading TikTok videos
homepage
repositoryhttps://github.com/Icytank/rtkd
max_upload_size
id1683332
size70,381
Icytank (Icytank)

documentation

README

RTKD - Rust TikTok Video Downloader

A minimal and flexible Rust library for downloading TikTok videos.

Features

  • Simple API for downloading TikTok videos
  • Builder pattern for flexible configuration
  • Customizable HTTP headers
  • Progress bar during download

Installation

Add this to your Cargo.toml:

[dependencies]
rtkd = "0.1.0"

Usage

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(())
}

Customizing Headers

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(())
}

License

This project is licensed under the MIT License.

Commit count: 0

cargo fmt