import { default } from "https://deno.land/x/youtubei@v9.3.0-deno/deno.ts";
Provides access to various services and modules in the YouTube API.
Constructors
Properties
readonly
fetch_function: FetchFunctionMethods
fetch(input: URL | Request | string, init?: RequestInit & HTTPClientInit): Promise<Response>
Constructors
new
default(session: Session)Methods
call<T extends IParsedResponse>(endpoint: NavigationEndpoint, args: { [key: string]: any; parse: true; }): Promise<T>
Utility method to call an endpoint without having to use Actions.
call(endpoint: NavigationEndpoint, args?: { [key: string]: any; parse?: false; }): Promise<ApiResponse>
download(video_id: string, options?: DownloadOptions): Promise<ReadableStream<Uint8Array>>
Downloads a given video. If you only need the direct download link see getStreamingData. If you wish to retrieve the video info too, have a look at getBasicInfo or getInfo.
getBasicInfo(video_id: string, client?: InnerTubeClient): Promise<VideoInfo>
Retrieves basic video info.
getComments(video_id: string, sort_by?: "TOP_COMMENTS" | "NEWEST_FIRST"): Promise<Comments>
Retrieves comments for a video.
getInfo(target: string | NavigationEndpoint, client?: InnerTubeClient): Promise<VideoInfo>
Retrieves video info.
getSearchSuggestions(query: string): Promise<string[]>
Retrieves search suggestions for a given query.
getShortsWatchItem(short_id: string, client?: InnerTubeClient): Promise<ShortsVideoInfo>
Retrieves shorts info.
getStreamingData(video_id: string, options?: FormatOptions): Promise<Format>
An alternative to download. Returns deciphered streaming data.
If you wish to retrieve the video info too, have a look at getBasicInfo or getInfo.
Static Methods
create(config?: InnertubeConfig): Promise<Innertube>
Constructors
new
default(context: Context,
api_key: string,
api_version: string,
account_index: number,
player?: Player,
cookie?: string,
fetch?: FetchFunction,
cache?: ICache,
Properties
Methods
on(type: "auth", listener: OAuthAuthEventHandler): void
on(type: "auth-pending", listener: OAuthAuthPendingEventHandler): void
on(type: "auth-error", listener: OAuthAuthErrorEventHandler): void
on(type: "update-credentials", listener: OAuthAuthEventHandler): void
once(type: "auth", listener: OAuthAuthEventHandler): void
once(type: "auth-pending", listener: OAuthAuthPendingEventHandler): void
once(type: "auth-error", listener: OAuthAuthErrorEventHandler): void
signIn(credentials?: Credentials): Promise<void>
Static Methods
create(options?: SessionOptions)
getSessionData()
lang?,
location?,
account_index?,
visitor_data?,
enable_safety_mode?,
generate_session_locally?,
device_category?: DeviceCategory,
client_name?: ClientType,
tz?: string,
fetch?: FetchFunction,
on_behalf_of_user?: string,
Constructors
new
default(session: Session)Properties
readonly
session: SessionMethods
execute<T extends InnertubeEndpoint>(endpoint: T, args: { [key: string]: any; parse: true; protobuf?: false; serialized_data?: any; }): Promise<ParsedResponse<T>>
Executes an API call.
execute<T extends InnertubeEndpoint>(endpoint: T, args?: { [key: string]: any; parse?: false; protobuf?: true; serialized_data?: any; }): Promise<ApiResponse>
Static Methods
create(cache: ICache | undefined, fetch?: FetchFunction): Promise<Player>
extractNSigSourceCode(data: string): string
extractSigSourceCode(data: string): string
extractSigTimestamp(data: string): number
fromSource(): Promise<Player>
Constructors
new
default(session: Session)Properties
readonly
credentials: Credentials | undefinedMethods
cacheCredentials(): Promise<void>
init(credentials?: Credentials): Promise<void>
Starts the auth flow in case no valid credentials are available.
removeCache(): Promise<void>
revokeCredentials(): Promise<Response | undefined>
validateCredentials(): this is this & { credentials: Credentials; }