pub struct CouldNotRetrieveTranscript {
pub video_id: String,
pub reason: Option<CouldNotRetrieveTranscriptReason>,
}
Expand description
§CouldNotRetrieveTranscript
The primary error type when transcript retrieval fails.
This error provides detailed information about why a transcript couldn’t be retrieved, with specific reasons and helpful suggestions for resolving the issue.
§Usage Example
let api = YouTubeTranscriptApi::new(None, None, None).unwrap();
match api.fetch_transcript("dQw4w9WgXcQ", &["en"], false).await {
Ok(transcript) => {
println!("Successfully retrieved transcript");
},
Err(err) => {
// The error message contains detailed information about what went wrong
eprintln!("Error: {}", err);
// You can also check for specific error types
if err.reason.is_some() {
match err.reason.as_ref().unwrap() {
// Handle specific error cases
_ => {}
}
}
}
}
Fields§
§video_id: String
The YouTube video ID that was being accessed
reason: Option<CouldNotRetrieveTranscriptReason>
The specific reason why the transcript couldn’t be retrieved
Trait Implementations§
Source§impl Debug for CouldNotRetrieveTranscript
impl Debug for CouldNotRetrieveTranscript
Source§impl Display for CouldNotRetrieveTranscript
impl Display for CouldNotRetrieveTranscript
Source§impl Error for CouldNotRetrieveTranscript
impl Error for CouldNotRetrieveTranscript
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for CouldNotRetrieveTranscript
impl !RefUnwindSafe for CouldNotRetrieveTranscript
impl Send for CouldNotRetrieveTranscript
impl Sync for CouldNotRetrieveTranscript
impl Unpin for CouldNotRetrieveTranscript
impl !UnwindSafe for CouldNotRetrieveTranscript
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
Mutably borrows from an owned value. Read more