Struct Video

Source
pub struct Video {
Show 24 fields pub id: String, pub title: String, pub thumbnail: String, pub description: String, pub availability: String, pub upload_date: i64, pub view_count: i64, pub like_count: Option<i64>, pub comment_count: Option<i64>, pub channel: String, pub channel_id: String, pub channel_url: String, pub channel_follower_count: Option<i64>, pub formats: Vec<Format>, pub thumbnails: Vec<Thumbnail>, pub automatic_captions: HashMap<String, Vec<AutomaticCaption>>, pub tags: Vec<String>, pub categories: Vec<String>, pub age_limit: i64, pub has_drm: Option<bool>, pub live_status: String, pub playable_in_embed: bool, pub extractor_info: ExtractorInfo, pub version: Version,
}
Expand description

Represents a YouTube video, the output of ‘yt-dlp’.

Fields§

§id: String

The ID of the video.

§title: String

The title of the video.

§thumbnail: String

The thumbnail URL of the video, usually the highest quality.

§description: String

The description of the video.

§availability: String

If the video is public, unlisted, or private.

§upload_date: i64

The upload date of the video.

§view_count: i64

The number of views the video has.

§like_count: Option<i64>

The number of likes the video has. None, when the author has hidden it.

§comment_count: Option<i64>

The number of comments the video has. None, when the author has disabled comments.

§channel: String

The channel display name.

§channel_id: String

The channel ID, not the @username.

§channel_url: String

The URL of the channel.

§channel_follower_count: Option<i64>

The number of subscribers the channel has.

§formats: Vec<Format>

The available formats of the video.

§thumbnails: Vec<Thumbnail>

The thumbnails of the video.

§automatic_captions: HashMap<String, Vec<AutomaticCaption>>

The automatic captions of the video.

§tags: Vec<String>

The tags of the video.

§categories: Vec<String>

The categories of the video.

§age_limit: i64

If the video is age restricted, the age limit is different from 0.

§has_drm: Option<bool>

If the video is available in the country.

§live_status: String

If the video was a live stream.

§playable_in_embed: bool

If the video is playable in an embed.

§extractor_info: ExtractorInfo

The extractor information.

§version: Version

The version of ‘yt-dlp’ used to fetch the video.

Implementations§

Source§

impl Video

Source

pub fn best_video_format(&self) -> Option<&Format>

Returns the best format available. Formats sorting : “quality”, “video resolution”, “fps”, “video bitrate” If the video has no formats video formats, it returns None.

Source

pub fn best_audio_format(&self) -> Option<&Format>

Returns the best audio format available. Formats sorting : “quality”, “audio bitrate”, “sample rate”, “audio channels” If the video has no formats audio formats, it returns None.

Source

pub fn worst_video_format(&self) -> Option<&Format>

Returns the worst video format available. Formats sorting : “quality”, “video resolution”, “fps”, “video bitrate” If the video has no formats video formats, it returns None.

Source

pub fn worst_audio_format(&self) -> Option<&Format>

Returns the worst audio format available. Formats sorting : “quality”, “audio bitrate”, “sample rate”, “audio channels” If the video has no formats audio formats, it returns None.

Source

pub fn compare_video_formats(&self, a: &Format, b: &Format) -> Ordering

Compares two video formats. Formats sorting : “quality”, “video resolution”, “fps”, “video bitrate”

Source

pub fn compare_audio_formats(&self, a: &Format, b: &Format) -> Ordering

Compares two audio formats. Formats sorting : “quality”, “audio bitrate”, “sample rate”, “audio channels”

Source

pub fn select_video_format( &self, quality: VideoQuality, codec: VideoCodecPreference, ) -> Option<&Format>

Selects a video format based on quality preference and codec preference.

§Arguments
  • quality - The desired video quality
  • codec - The preferred video codec
§Returns

The selected format, or None if no suitable format is found

Source

pub fn select_audio_format( &self, quality: AudioQuality, codec: AudioCodecPreference, ) -> Option<&Format>

Selects an audio format based on quality preference and codec preference.

§Arguments
  • quality - The desired audio quality
  • codec - The preferred audio codec
§Returns

The selected format, or None if no suitable format is found

Trait Implementations§

Source§

impl Clone for Video

Source§

fn clone(&self) -> Video

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Video

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Video

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Video

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Video

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Video

Source§

fn eq(&self, other: &Video) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Video

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Video

Source§

impl StructuralPartialEq for Video

Auto Trait Implementations§

§

impl Freeze for Video

§

impl RefUnwindSafe for Video

§

impl Send for Video

§

impl Sync for Video

§

impl Unpin for Video

§

impl UnwindSafe for Video

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> AllTraits for T
where T: Debug + Clone + PartialEq + Display + Eq + Hash,

Source§

impl<T> CommonTraits for T
where T: Debug + Clone + PartialEq + Display,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T