pub struct Video(/* private fields */);Implementations§
Source§impl Video
impl Video
Sourcepub fn new(url_or_id: impl Into<String>) -> Result<Self, VideoError>
pub fn new(url_or_id: impl Into<String>) -> Result<Self, VideoError>
Crate Video struct to get info or download with default VideoOptions
Sourcepub fn new_with_options(
url_or_id: impl Into<String>,
options: VideoOptions,
) -> Result<Self, VideoError>
pub fn new_with_options( url_or_id: impl Into<String>, options: VideoOptions, ) -> Result<Self, VideoError>
Crate Video struct to get info or download with custom VideoOptions
Sourcepub fn get_basic_info(&self) -> Result<VideoInfo, VideoError>
pub fn get_basic_info(&self) -> Result<VideoInfo, VideoError>
Try to get basic information about video
HLSandDashMPDformats excluded!
Sourcepub fn get_info(&self) -> Result<VideoInfo, VideoError>
pub fn get_info(&self) -> Result<VideoInfo, VideoError>
Try to get full information about video
HLSandDashMPDformats included!
Sourcepub fn stream(&self) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
pub fn stream(&self) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
Try to turn Stream implemented LiveStream or NonLiveStream depend on the video.
If function successfully return can download video chunk by chunk
§Example
let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc";
let video = Video::new(video_url).unwrap();
let stream = video.stream().unwrap();
while let Some(chunk) = stream.chunk().unwrap() {
println!("{:#?}", chunk);
}Sourcepub async fn stream_with_ffmpeg(
&self,
ffmpeg_args: Option<FFmpegArgs>,
) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
pub async fn stream_with_ffmpeg( &self, ffmpeg_args: Option<FFmpegArgs>, ) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
Try to turn Stream implemented LiveStream or NonLiveStream depend on the video with FFmpegArgs.
If function successfully return can download video with applied ffmpeg filters and formats chunk by chunk
§Example
let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc";
let video = Video::new(video_url).unwrap();
let stream = video.stream_with_ffmpeg(Some(FFmpegArgs {
format: Some("mp3".to_string()),
audio_filter: Some("aresample=48000,asetrate=48000*0.8".to_string()),
video_filter: Some("eq=brightness=150:saturation=2".to_string()),
})).unwrap();
while let Some(chunk) = stream.chunk().unwrap() {
println!("{:#?}", chunk);
}Sourcepub fn download<P: AsRef<Path>>(&self, path: P) -> Result<(), VideoError>
pub fn download<P: AsRef<Path>>(&self, path: P) -> Result<(), VideoError>
Download video directly to the file
Sourcepub async fn download_with_ffmpeg<P: AsRef<Path>>(
&self,
path: P,
ffmpeg_args: Option<FFmpegArgs>,
) -> Result<(), VideoError>
pub async fn download_with_ffmpeg<P: AsRef<Path>>( &self, path: P, ffmpeg_args: Option<FFmpegArgs>, ) -> Result<(), VideoError>
Download video with ffmpeg args directly to the file
Sourcepub fn get_video_url(&self) -> String
pub fn get_video_url(&self) -> String
Get video URL
Sourcepub fn get_video_id(&self) -> String
pub fn get_video_id(&self) -> String
Get video id
Methods from Deref<Target = AsyncVideo>§
Sourcepub async fn get_basic_info(&self) -> Result<VideoInfo, VideoError>
pub async fn get_basic_info(&self) -> Result<VideoInfo, VideoError>
Try to get basic information about video
HLSandDashMPDformats excluded!
Sourcepub async fn get_info(&self) -> Result<VideoInfo, VideoError>
pub async fn get_info(&self) -> Result<VideoInfo, VideoError>
Try to get full information about video
HLSandDashMPDformats included!
Sourcepub async fn stream(&self) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
pub async fn stream(&self) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
Try to turn Stream implemented LiveStream or NonLiveStream depend on the video.
If function successfully return can download video chunk by chunk
§Example
let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc";
let video = Video::new(video_url).unwrap();
let stream = video.stream().await.unwrap();
while let Some(chunk) = stream.chunk().await.unwrap() {
println!("{:#?}", chunk);
}Sourcepub async fn stream_with_ffmpeg(
&self,
ffmpeg_args: Option<FFmpegArgs>,
) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
pub async fn stream_with_ffmpeg( &self, ffmpeg_args: Option<FFmpegArgs>, ) -> Result<Box<dyn Stream + Send + Sync>, VideoError>
Try to turn Stream implemented LiveStream or NonLiveStream depend on the video with FFmpegArgs.
If function successfully return can download video with applied ffmpeg filters and formats chunk by chunk
§Example
let video_url = "https://www.youtube.com/watch?v=FZ8BxMU3BYc";
let video = Video::new(video_url).unwrap();
let stream = video.stream_with_ffmpeg(Some(FFmpegArgs {
format: Some("mp3".to_string()),
audio_filter: Some("aresample=48000,asetrate=48000*0.8".to_string()),
video_filter: Some("eq=brightness=150:saturation=2".to_string()),
})).await.unwrap();
while let Some(chunk) = stream.chunk().await.unwrap() {
println!("{:#?}", chunk);
}Sourcepub async fn download<P: AsRef<Path>>(&self, path: P) -> Result<(), VideoError>
pub async fn download<P: AsRef<Path>>(&self, path: P) -> Result<(), VideoError>
Download video directly to the file
Sourcepub async fn download_with_ffmpeg<P: AsRef<Path>>(
&self,
path: P,
ffmpeg_args: Option<FFmpegArgs>,
) -> Result<(), VideoError>
pub async fn download_with_ffmpeg<P: AsRef<Path>>( &self, path: P, ffmpeg_args: Option<FFmpegArgs>, ) -> Result<(), VideoError>
Download video with ffmpeg args directly to the file
Sourcepub fn get_video_url(&self) -> String
pub fn get_video_url(&self) -> String
Get video URL
Sourcepub fn get_video_id(&self) -> String
pub fn get_video_id(&self) -> String
Get video id
Trait Implementations§
impl Eq for Video
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> 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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.