how to use

build client

build from url or live_id or channel_id

rust // pattern 1 let mut client = LiveClientBuilder::new() .url("https://www.youtube.com/watch?v=jfKfPfyJRdk".to_string()) .unwrap() .build(); // pattern 2 let mut client = LiveChatClientBuilder::new() .live_id("jfKfPfyJRd".to_string()) .build(); // pattern 3 let mut client = LiveChatClientBuilder::new() .channel_id("UCHVXbQzkl3rDfsXWo8xi2qw".to_string()) .build();

add callback function (each callback function is optional)

get ready for fetching live

rust client.start().await.unwrap();

fetch chat comments

rust client.execute().await;

call execute intervally if you want to fetch comments in real time

Example using tokio ```rust use std::time::Duration;

use tokio::{task, time}; use youtubechat::livechat::LiveChatClientBuilder;

[tokio::main]

async fn main() { let mut client = LiveChatClientBuilder::new() .url("https://www.youtube.com/watch?v=jfKfPfyJRdk".tostring()) .unwrap() .onchat(|chatitem| println!("{:?}", chatitem.message)) .onerror(|error| eprintln!("{:?}", error)) .build(); client.start().await.unwrap(); let forever = task::spawn(async move { let mut interval = time::interval(Duration::frommillis(3000)); loop { interval.tick().await; client.execute().await; } });

forever.await.unwrap();

} ```