Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 9x 1x 5x 1x 1x 1x | import { formatErrorMessage } from './utils/format.js';
/**
* Base error class for YouTube transcript errors
*/
export class TranscriptError extends Error {
constructor(message: string) {
super(formatErrorMessage(message));
}
}
/**
* Error thrown when YouTube's rate limit is exceeded
*/
export class RateLimitError extends TranscriptError {
constructor() {
super(
'⚠️ Rate Limit Exceeded\n' +
'\n' +
'YouTube is receiving too many requests from this IP.\n' +
'Please try again later or use a different IP address.'
);
}
}
/**
* Error thrown when the requested video does not exist or is private
*/
export class VideoUnavailableError extends TranscriptError {
constructor(videoId: string) {
super(
'🚫 Video Unavailable\n' +
'\n' +
`The video "${videoId}" is no longer available.\n` +
'It may have been removed or set to private.'
);
}
}
/**
* Error thrown when transcripts are disabled for the video
*/
export class TranscriptDisabledError extends TranscriptError {
constructor(videoId: string) {
super(
'❌ Transcripts Disabled\n' +
'\n' +
`Transcripts are disabled for video "${videoId}".\n` +
'The video owner has not enabled transcripts for this content.'
);
}
}
/**
* Error thrown when no transcripts exist for the video
*/
export class NoTranscriptError extends TranscriptError {
constructor(videoId: string) {
super(
'📝 No Transcripts Available\n' +
'\n' +
`No transcripts were found for video "${videoId}".\n` +
'This video may not have any transcripts generated yet.'
);
}
}
/**
* Error thrown when the requested language is not available
*/
export class LanguageNotFoundError extends TranscriptError {
constructor(lang: string, availableLangs: string[], videoId: string) {
super(
'🌐 Language Not Available\n' +
'\n' +
`Transcripts in "${lang}" are not available for video "${videoId}".\n` +
'\n' +
'Available languages:\n' +
availableLangs.map(l => ` • ${l}`).join('\n')
);
}
}
|