pub struct TikTokDownloaderBuilder { /* private fields */ }Expand description
Builder for TikTokDownloader
Implementations§
Source§impl TikTokDownloaderBuilder
impl TikTokDownloaderBuilder
Sourcepub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
Set custom HTTP headers
Sourcepub fn with_header(self, key: &str, value: &str) -> Self
pub fn with_header(self, key: &str, value: &str) -> Self
Set a specific header
Set the cookie for authentication
Examples found in repository?
examples/simple_downloader.rs (line 24)
6async fn main() -> Result<()> {
7 // Get video URL and output path from command line arguments
8 let args: Vec<String> = env::args().collect();
9 if args.len() < 3 {
10 eprintln!("Usage: {} <tiktok_url> <output_path>", args[0]);
11 std::process::exit(1);
12 }
13
14 let tiktok_url = &args[1];
15 let output_path = &args[2];
16
17 // Replace this with your actual TikTok cookie
18 let cookie = "cookie string from webui";
19
20 println!("Initializing TikTok downloader...");
21
22 // Initialize downloader with the cookie
23 let downloader = TikTokDownloader::builder()
24 .with_cookie(cookie)
25 .build()?;
26
27 println!("Downloading video from {} to {}", tiktok_url, output_path);
28
29 // Download the video
30 downloader.download_video(tiktok_url, output_path).await?;
31
32 println!("Download complete!");
33 Ok(())
34}Sourcepub fn build(self) -> Result<TikTokDownloader>
pub fn build(self) -> Result<TikTokDownloader>
Build the TikTokDownloader
Examples found in repository?
examples/simple_downloader.rs (line 25)
6async fn main() -> Result<()> {
7 // Get video URL and output path from command line arguments
8 let args: Vec<String> = env::args().collect();
9 if args.len() < 3 {
10 eprintln!("Usage: {} <tiktok_url> <output_path>", args[0]);
11 std::process::exit(1);
12 }
13
14 let tiktok_url = &args[1];
15 let output_path = &args[2];
16
17 // Replace this with your actual TikTok cookie
18 let cookie = "cookie string from webui";
19
20 println!("Initializing TikTok downloader...");
21
22 // Initialize downloader with the cookie
23 let downloader = TikTokDownloader::builder()
24 .with_cookie(cookie)
25 .build()?;
26
27 println!("Downloading video from {} to {}", tiktok_url, output_path);
28
29 // Download the video
30 downloader.download_video(tiktok_url, output_path).await?;
31
32 println!("Download complete!");
33 Ok(())
34}Trait Implementations§
Source§impl Clone for TikTokDownloaderBuilder
impl Clone for TikTokDownloaderBuilder
Source§fn clone(&self) -> TikTokDownloaderBuilder
fn clone(&self) -> TikTokDownloaderBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TikTokDownloaderBuilder
impl Debug for TikTokDownloaderBuilder
Auto Trait Implementations§
impl Freeze for TikTokDownloaderBuilder
impl RefUnwindSafe for TikTokDownloaderBuilder
impl Send for TikTokDownloaderBuilder
impl Sync for TikTokDownloaderBuilder
impl Unpin for TikTokDownloaderBuilder
impl UnsafeUnpin for TikTokDownloaderBuilder
impl UnwindSafe for TikTokDownloaderBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more