Skip to main content

Generic

Struct Generic 

Source
pub struct Generic { /* private fields */ }
Expand description

Generic extractor for all non-YouTube sites.

This extractor provides a simple wrapper around yt-dlp that works with any supported site. It includes helpers for authentication.

Implementations§

Source§

impl Generic

Source

pub fn new(executable_path: PathBuf) -> Self

Create a new generic extractor with automatic detection.

§Arguments
  • executable_path - Path to the yt-dlp executable
§Returns

A new Generic extractor instance

Source

pub fn for_extractor(executable_path: PathBuf, name: String) -> Self

Create for specific extractor (skip detection).

§Arguments
  • executable_path - Path to the yt-dlp executable
  • name - Name of the extractor to use
§Returns

A new Generic extractor instance for the specified extractor

Source

pub fn with_extractor_args(&mut self, extractor: &str, args: &str) -> &mut Self

Add extractor-specific arguments.

§Arguments
  • extractor - Name of the extractor
  • args - Arguments to pass to the extractor
§Returns

Self for method chaining

§Examples
let mut extractor = Generic::new(PathBuf::from("yt-dlp"));
extractor.with_extractor_args("tiktok", "api_hostname=api-h2.tiktokv.com");
Source

pub fn with_credentials(&mut self, username: &str, password: &str) -> &mut Self

Use credentials for sites requiring login.

Security note: Credentials are passed via --username and --password CLI arguments, which may be visible in process listings. For sensitive environments, prefer [with_netrc] or [with_cookies] on the Downloader instead.

§Arguments
  • username - Username for authentication
  • password - Password for authentication
§Returns

Self for method chaining

§Examples
let mut extractor = Generic::new(PathBuf::from("yt-dlp"));
extractor.with_credentials("user@email.com", "password");

Trait Implementations§

Source§

impl Clone for Generic

Source§

fn clone(&self) -> Generic

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Generic

Source§

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

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

impl ExtractorBase for Generic

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.
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. Read more
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. Read more
Source§

impl ExtractorConfig for Generic

Source§

fn args_mut(&mut self) -> &mut Vec<String>

Returns a mutable reference to the internal args vector.
Source§

fn timeout_mut(&mut self) -> &mut Duration

Returns a mutable reference to the internal timeout.
Source§

fn with_arg(&mut self, arg: String) -> &mut Self

Add custom yt-dlp argument.
Source§

fn with_timeout(&mut self, timeout: Duration) -> &mut Self

Set timeout for yt-dlp operations.
Source§

fn with_cookies(&mut self, path: impl AsRef<Path>) -> &mut Self

Use a Netscape cookie file for authentication.
Source§

fn with_cookies_from_browser(&mut self, browser: &str) -> &mut Self

Extract cookies from a browser for authentication.
Source§

fn with_netrc(&mut self) -> &mut Self

Use .netrc for authentication.
Source§

impl VideoExtractor for Generic

Source§

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

Fetch video metadata from a URL. Read more
Source§

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

Fetch playlist metadata from a URL. Read more
Source§

fn name(&self) -> ExtractorName

Get the name of this extractor.
Source§

fn supports_url(&self, _url: &str) -> bool

Check if this extractor supports the given URL pattern. Read more

Auto Trait Implementations§

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<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, 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