pub struct Youtube { /* private fields */ }Expand description
YouTube TranscriptSource.
Holds a single reqwest::Client reused across the watch-page,
InnerTube, and timedtext calls. Cheap to construct; in steady state
it is fine to keep one instance per process.
On first use, a visitorData token is scraped from the watch page
and cached in tokio::sync::OnceCell. Concurrent first-callers
serialise on a single fetch rather than double-fetching, and every
subsequent InnerTube /player POST forwards the cached token.
Implementations§
Source§impl Youtube
impl Youtube
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Construct a YouTube source with default HTTP settings (30 s timeout, ANDROID_VR User-Agent) targeting the public YouTube origin.
Sourcepub fn with_base_url(base_url: impl Into<String>) -> Result<Self>
pub fn with_base_url(base_url: impl Into<String>) -> Result<Self>
Construct a YouTube source pointed at an alternate origin. Used by
tests to inject a wiremock::MockServer::uri(). The HTTP client
retains the production timeout and User-Agent so request shape
matches the real client.
Trait Implementations§
Source§impl TranscriptSource for Youtube
impl TranscriptSource for Youtube
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
"youtube"). Used
in error messages, the Transcript::source field, and as the
CLI subcommand name.Source§fn matches(url: &str) -> bool
fn matches(url: &str) -> bool
url as one of its locators. Used by
future auto-detection (omni-dev transcript fetch <url>). Read moreSource§fn fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
locator: &'life1 str,
opts: &'life2 FetchOpts,
) -> Pin<Box<dyn Future<Output = Result<Transcript>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
locator: &'life1 str,
opts: &'life2 FetchOpts,
) -> Pin<Box<dyn Future<Output = Result<Transcript>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
locator to a transcript matching opts.Auto Trait Implementations§
impl !Freeze for Youtube
impl !RefUnwindSafe for Youtube
impl Send for Youtube
impl Sync for Youtube
impl Unpin for Youtube
impl UnsafeUnpin for Youtube
impl !UnwindSafe for Youtube
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<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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 more