Skip to main content

ExtractorBase

Trait ExtractorBase 

Source
pub trait ExtractorBase: VideoExtractor {
    // Required methods
    fn executable_path(&self) -> PathBuf;
    fn timeout(&self) -> Duration;
    fn build_base_args(&self) -> Vec<String>;

    // Provided methods
    fn fetch_video_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Video>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn fetch_playlist_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Playlist>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn log_and_fetch_video<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        extractor: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Video>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn log_and_fetch_playlist<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        extractor: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Playlist>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Common logic for extractors to execute yt-dlp and parse output.

Required Methods§

Source

fn executable_path(&self) -> PathBuf

Get the executable path.

Source

fn timeout(&self) -> Duration

Get the request timeout.

Source

fn build_base_args(&self) -> Vec<String>

Build base arguments for yt-dlp.

Provided Methods§

Source

fn fetch_video_metadata<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Video>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch and parse video metadata.

Source

fn fetch_playlist_metadata<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Playlist>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch and parse playlist metadata.

Source

fn log_and_fetch_video<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, extractor: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Video>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches video metadata and emits structured tracing on success or failure.

Wraps fetch_video_metadata with a consistent log pattern. Call this from VideoExtractor::fetch_video implementations to avoid repeating the match-and-log boilerplate. The extractor string is emitted as a structured field so each implementor can identify itself in logs.

Source

fn log_and_fetch_playlist<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, extractor: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Playlist>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches playlist metadata and emits structured tracing on success or failure.

Wraps fetch_playlist_metadata with a consistent log pattern. Call this from VideoExtractor::fetch_playlist implementations to avoid repeating the match-and-log boilerplate.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§