pub struct VideoDetails {
pub video_id: String,
pub title: String,
pub length_seconds: u32,
pub keywords: Option<Vec<String>>,
pub channel_id: String,
pub short_description: String,
pub view_count: String,
pub author: String,
pub thumbnails: Vec<VideoThumbnail>,
pub is_live_content: bool,
}
Expand description
§VideoDetails
Comprehensive metadata about a YouTube video.
This struct contains detailed information about a video, extracted from YouTube’s player response. It includes basic information like title and author, as well as more detailed metadata like view count, keywords, and thumbnails.
§Fields
video_id
- The unique YouTube ID for the videotitle
- The video’s titlelength_seconds
- The video duration in secondskeywords
- Optional list of keywords/tags associated with the videochannel_id
- The YouTube channel IDshort_description
- The video descriptionview_count
- Number of views as a string (to handle very large numbers)author
- Name of the channel/creatorthumbnails
- List of available thumbnail images in various resolutionsis_live_content
- Whether the video is or was a live stream
§Example Usage
let api = YouTubeTranscriptApi::new(None, None, None)?;
let video_id = "dQw4w9WgXcQ";
// Fetch video details
let details = api.fetch_video_details(video_id).await?;
println!("Title: {}", details.title);
println!("By: {} ({})", details.author, details.channel_id);
println!("Duration: {} seconds", details.length_seconds);
println!("Views: {}", details.view_count);
// Get highest resolution thumbnail
if let Some(thumbnail) = details.thumbnails.iter().max_by_key(|t| t.width * t.height) {
println!("Thumbnail URL: {}", thumbnail.url);
}
Fields§
§video_id: String
The unique YouTube video ID (e.g., “dQw4w9WgXcQ”)
title: String
The video’s title
length_seconds: u32
Total duration of the video in seconds
keywords: Option<Vec<String>>
Optional list of keywords/tags associated with the video
channel_id: String
The YouTube channel ID that published the video
short_description: String
The video description text
view_count: String
Number of views as a string (to handle potentially very large numbers)
Name of the channel/creator who published the video
thumbnails: Vec<VideoThumbnail>
List of available thumbnail images in various resolutions
is_live_content: bool
Whether the video is or was a live stream
Trait Implementations§
Source§impl Clone for VideoDetails
impl Clone for VideoDetails
Source§fn clone(&self) -> VideoDetails
fn clone(&self) -> VideoDetails
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VideoDetails
impl Debug for VideoDetails
Source§impl<'de> Deserialize<'de> for VideoDetails
impl<'de> Deserialize<'de> for VideoDetails
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VideoDetails
impl RefUnwindSafe for VideoDetails
impl Send for VideoDetails
impl Sync for VideoDetails
impl Unpin for VideoDetails
impl UnwindSafe for VideoDetails
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