pub struct Format {Show 18 fields
pub format: String,
pub format_id: String,
pub format_note: Option<String>,
pub protocol: Protocol,
pub language: Option<String>,
pub has_drm: Option<DrmStatus>,
pub container: Option<Container>,
pub available_at: Option<i64>,
pub language_preference: Option<i64>,
pub source_preference: Option<i64>,
pub codec_info: CodecInfo,
pub video_resolution: VideoResolution,
pub download_info: DownloadInfo,
pub quality_info: QualityInfo,
pub file_info: FileInfo,
pub storyboard_info: StoryboardInfo,
pub rates_info: RatesInfo,
pub video_id: Option<String>,
}Expand description
Represents an available format of a video. It can be audio, video, both of them, a manifest, or a storyboard.
A manifest is a file that contains metadata about the video streams, and how to assemble them. A storyboard is a file that contains grid of images from the video, allowing users to preview the video. Usually, these formats are not meant to be downloaded, but to be used by the player. So, in most cases, you can ignore them.
Fields§
§format: StringThe display name of the format, e.g. ‘303 - 1920x1080 (1080p60)’.
format_id: StringThe format ID, e.g. ‘303’.
format_note: Option<String>The format note, e.g. ‘1080p60’.
protocol: ProtocolThe type of the format.
language: Option<String>The language of the format.
has_drm: Option<DrmStatus>If the format has DRM.
container: Option<Container>The extension of the file containing the format.
available_at: Option<i64>The Unix timestamp when this format’s stream URL became available (yt-dlp fetch time). Used to detect CDN URL expiry: YouTube URLs typically last ~6 hours after this timestamp.
language_preference: Option<i64>yt-dlp internal language preference score for this format.
source_preference: Option<i64>yt-dlp internal source preference score for this format.
codec_info: CodecInfoAll the codec-related information.
video_resolution: VideoResolutionAll the video resolution-related information.
download_info: DownloadInfoAll the download-related information.
quality_info: QualityInfoAll the quality-related information.
file_info: FileInfoAll the file-related information.
storyboard_info: StoryboardInfoAll the storyboard-related information.
rates_info: RatesInfoAll the rates-related information.
video_id: Option<String>The ID of the video this format belongs to. This field is not part of the yt-dlp output, but is added by the library to associate formats with their videos for caching purposes.
Implementations§
Source§impl Format
impl Format
Sourcepub fn format_type(&self) -> FormatType
pub fn format_type(&self) -> FormatType
Gets the type of the format. It can be audio, video, both of them, a manifest, or a storyboard.
§Returns
The FormatType determined from the codec and manifest information.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Format
impl<'de> Deserialize<'de> for Format
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>,
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnsafeUnpin for Format
impl UnwindSafe for Format
Blanket Implementations§
impl<T> AllTraits for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CommonTraits for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.