yt-transcript
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -24,2 +24,42 @@ type Only<T, U> = { | ||
/** | ||
* YtTranscript is a simple unoffical library to interact with YouTube transcripts for Chrome extension | ||
* this library is inspired from Python library `youtube-transcript-api` | ||
* @class | ||
* @classdesc Class to interact with YouTube transcripts | ||
* @example | ||
* const transcript = new YtTranscriptChrome({ html: '<html>...</html>' }) | ||
* const transcript = new YtTranscriptChrome({ html: '<html>...</html>' }) | ||
* | ||
* const list = await transcript.listAllTranscripts() | ||
* const script = await transcript.getTranscript('en-US') | ||
*/ | ||
declare class YtTranscriptChrome { | ||
private html; | ||
/** | ||
* Create a new instance of YtTranscript | ||
* @param {html} param0 | ||
*/ | ||
constructor({ html }: { | ||
html: string; | ||
}); | ||
/** | ||
* List all available transcripts for the video | ||
* @returns {Promise<TrasncriptInfo[]>} returns a list of available transcripts | ||
*/ | ||
listAllTranscripts(): Promise<TrasncriptInfo[]>; | ||
/** | ||
* Get transcript by language | ||
* @param {string} languageCode | ||
* @returns {Promise<TrasncriptInfo | null>} returns a transcript object or null if not found | ||
*/ | ||
getTranscriptByLanguage(languageCode: string): Promise<TrasncriptInfo | null>; | ||
/** | ||
* Get transcript by language | ||
* @param {string} languageCode | ||
* @returns {Promise<YTranscript | null>} returns a transcript object or null if not found | ||
*/ | ||
getTranscript(languageCode?: string): Promise<YTranscript[] | null>; | ||
} | ||
type YtTranscriptConstructor = Either<{ | ||
@@ -40,3 +80,3 @@ url: string; | ||
* const list = await transcript.listAllTranscripts() | ||
* const transcript = await transcript.getTranscript('en-US') | ||
* const script = await transcript.getTranscript('en-US') | ||
*/ | ||
@@ -69,2 +109,2 @@ declare class YtTranscript { | ||
export { YtTranscript }; | ||
export { YtTranscript, YtTranscriptChrome }; |
{ | ||
"name": "yt-transcript", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"packageManager": "pnpm@8.15.3", | ||
@@ -6,0 +6,0 @@ "description": "A youtube transcript fetcher", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29484
556