youtubei.js / Innertube
Class: Innertube
Defined in: src/Innertube.ts:64
Provides access to various services and modules in the YouTube API.
Example
import { Innertube, UniversalCache } from 'youtubei.js';
const innertube = await Innertube.create({ cache: new UniversalCache(true)});
Constructors
Constructor
new Innertube(
session):Innertube
Defined in: src/Innertube.ts:67
Parameters
session
Returns
Innertube
Accessors
account
Get Signature
get account():
AccountManager
Defined in: src/Innertube.ts:609
An interface for managing and retrieving account information.
Returns
actions
Get Signature
get actions():
Actions
Defined in: src/Innertube.ts:630
An internal class used to dispatch requests.
Returns
interact
Get Signature
get interact():
InteractionManager
Defined in: src/Innertube.ts:623
An interface for directly interacting with certain YouTube features.
Returns
kids
Get Signature
get kids():
Kids
Defined in: src/Innertube.ts:602
An interface for interacting with YouTube Kids.
Returns
music
Get Signature
get music():
Music
Defined in: src/Innertube.ts:588
An interface for interacting with YouTube Music.
Returns
playlist
Get Signature
get playlist():
PlaylistManager
Defined in: src/Innertube.ts:616
An interface for managing playlists.
Returns
session
Get Signature
get session():
Session
Defined in: src/Innertube.ts:637
The session used by this instance.
Returns
studio
Get Signature
get studio():
Studio
Defined in: src/Innertube.ts:595
An interface for interacting with YouTube Studio.
Returns
Methods
call()
Call Signature
call<
T>(endpoint,args):Promise<T>
Defined in: src/Innertube.ts:579
Utility method to call an endpoint without having to use Actions.
Type Parameters
T
T extends IParsedResponse
Parameters
endpoint
args
parse
true
Returns
Promise<T>
Call Signature
call(
endpoint,args?):Promise<ApiResponse>
Defined in: src/Innertube.ts:580
Utility method to call an endpoint without having to use Actions.
Parameters
endpoint
args?
parse?
false
Returns
Promise<ApiResponse>
download()
download(
video_id,options?):Promise<ReadableStream<Uint8Array>>
Defined in: src/Innertube.ts:477
Downloads a given video. If all you need the direct download link, see getStreamingData. If you wish to retrieve the video info too, have a look at getBasicInfo or getInfo.
Parameters
video_id
string
The video id.
options?
Download options.
Returns
Promise<ReadableStream<Uint8Array>>
getAttestationChallenge()
getAttestationChallenge(
engagement_type,ids?):Promise<IGetChallengeResponse>
Defined in: src/Innertube.ts:565
Fetches an attestation challenge.
Parameters
engagement_type
ids?
Record<string, any>[]
Returns
Promise<IGetChallengeResponse>
getBasicInfo()
getBasicInfo(
video_id,options?):Promise<VideoInfo>
Defined in: src/Innertube.ts:124
Parameters
video_id
string
options?
Returns
Promise<VideoInfo>
getChannel()
getChannel(
id):Promise<Channel>
Defined in: src/Innertube.ts:391
Parameters
id
string
Returns
Promise<Channel>
getChannelsFeed()
getChannelsFeed():
Promise<Feed<IBrowseResponse>>
Defined in: src/Innertube.ts:385
Returns
Promise<Feed<IBrowseResponse>>
getComments()
getComments(
video_id,sort_by?,comment_id?):Promise<Comments>
Defined in: src/Innertube.ts:306
Parameters
video_id
string
sort_by?
"TOP_COMMENTS" | "NEWEST_FIRST"
comment_id?
string
Returns
Promise<Comments>
getCourses()
getCourses():
Promise<Feed<IBrowseResponse>>
Defined in: src/Innertube.ts:373
Returns
Promise<Feed<IBrowseResponse>>
getGuide()
getGuide():
Promise<Guide>
Defined in: src/Innertube.ts:350
Returns
Promise<Guide>
getHashtag()
getHashtag(
hashtag):Promise<HashtagFeed>
Defined in: src/Innertube.ts:436
Parameters
hashtag
string
Returns
Promise<HashtagFeed>
getHistory()
getHistory():
Promise<History>
Defined in: src/Innertube.ts:361
Returns
Promise<History>
getHomeFeed()
getHomeFeed():
Promise<HomeFeed>
Defined in: src/Innertube.ts:344
Returns
Promise<HomeFeed>
getInfo()
getInfo(
target,options?):Promise<VideoInfo>
Defined in: src/Innertube.ts:75
Parameters
target
string | NavigationEndpoint
options?
Returns
Promise<VideoInfo>
getLibrary()
getLibrary():
Promise<Library>
Defined in: src/Innertube.ts:355
Returns
Promise<Library>
getNotifications()
getNotifications():
Promise<NotificationsMenu>
Defined in: src/Innertube.ts:403
Returns
Promise<NotificationsMenu>
getPlaylist()
getPlaylist(
id):Promise<Playlist>
Defined in: src/Innertube.ts:423
Parameters
id
string
Returns
Promise<Playlist>
getPlaylists()
getPlaylists():
Promise<Feed<IBrowseResponse>>
Defined in: src/Innertube.ts:417
Retrieves the user's playlists.
Returns
Promise<Feed<IBrowseResponse>>
getPost()
getPost(
post_id,channel_id):Promise<Feed<IBrowseResponse>>
Defined in: src/Innertube.ts:497
Gets a post page given a post id and the channel id
Parameters
post_id
string
channel_id
string
Returns
Promise<Feed<IBrowseResponse>>
getPostComments()
getPostComments(
post_id,channel_id,sort_by?):Promise<Comments>
Defined in: src/Innertube.ts:518
Gets the comments of a post.
Parameters
post_id
string
channel_id
string
sort_by?
"TOP_COMMENTS" | "NEWEST_FIRST"
Returns
Promise<Comments>
getSearchSuggestions()
getSearchSuggestions(
query,previous_query?):Promise<string[]>
Defined in: src/Innertube.ts:277
Parameters
query
string
previous_query?
string
Returns
Promise<string[]>
getShortsVideoInfo()
getShortsVideoInfo(
video_id,client?):Promise<ShortFormVideoInfo>
Defined in: src/Innertube.ts:166
Parameters
video_id
string
client?
Returns
Promise<ShortFormVideoInfo>
getStreamingData()
getStreamingData(
video_id,options):Promise<Format>
Defined in: src/Innertube.ts:462
An alternative to download. Returns deciphered streaming data.
If you wish to retrieve the video info too, have a look at getBasicInfo or getInfo.
Parameters
video_id
string
The video id.
options
FormatOptions = {}
Format options.
Returns
Promise<Format>
getSubscriptionsFeed()
getSubscriptionsFeed():
Promise<Feed<IBrowseResponse>>
Defined in: src/Innertube.ts:379
Returns
Promise<Feed<IBrowseResponse>>
getTrending()
getTrending():
Promise<TabbedFeed<IBrowseResponse>>
Defined in: src/Innertube.ts:367
Returns
Promise<TabbedFeed<IBrowseResponse>>
getUnseenNotificationsCount()
getUnseenNotificationsCount():
Promise<number>
Defined in: src/Innertube.ts:408
Returns
Promise<number>
resolveURL()
resolveURL(
url):Promise<NavigationEndpoint>
Defined in: src/Innertube.ts:485
Resolves the given URL.
Parameters
url
string
Returns
Promise<NavigationEndpoint>
search()
search(
query,filters):Promise<Search>
Defined in: src/Innertube.ts:201
Parameters
query
string
filters
SearchFilters = {}
Returns
Promise<Search>
create()
staticcreate(config):Promise<Innertube>
Defined in: src/Innertube.ts:71
Parameters
config
SessionOptions = {}
Returns
Promise<Innertube>