Skip to main content
Module

x/youtubei/deno.ts>Session

A wrapper around YouTube's internal API — reverse engineering InnerTube
Very Popular
Go to Latest
class Session
extends EventEmitter
Re-export
import { Session } from "https://deno.land/x/youtubei@v9.3.0-deno/deno.ts";

Represents an InnerTube session. This holds all the data needed to make requests to YouTube.

Constructors

new
Session(
context: Context,
api_key: string,
api_version: string,
account_index: number,
player?: Player,
cookie?: string,
fetch?: FetchFunction,
cache?: ICache,
)

Properties

readonly
account_index: number
actions: Actions
readonly
api_version: string

InnerTube API version.

optional
cache: ICache
readonly
client_name: string
readonly
client_version: string
readonly
context: Context
readonly
key: string

InnerTube API key.

readonly
lang: string
logged_in: boolean
oauth: OAuth
readonly
player: Player | undefined

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>
signOut(): Promise<Response | undefined>

Signs out of the current account and revokes the credentials.

Static Methods

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,
)