youtubei.js / Innertube
Class: Innertube
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
new Innertube()
new Innertube(
session
):Innertube
Parameters
• session: Session
Returns
Defined in
Accessors
account
get
account():AccountManager
An interface for managing and retrieving account information.
Returns
Defined in
actions
get
actions():Actions
An internal class used to dispatch requests.
Returns
Defined in
interact
get
interact():InteractionManager
An interface for directly interacting with certain YouTube features.
Returns
Defined in
kids
get
kids():Kids
An interface for interacting with YouTube Kids.
Returns
Defined in
music
get
music():Music
An interface for interacting with YouTube Music.
Returns
Defined in
playlist
get
playlist():PlaylistManager
An interface for managing playlists.
Returns
Defined in
session
get
session():Session
The session used by this instance.
Returns
Defined in
studio
get
studio():Studio
An interface for interacting with YouTube Studio.
Returns
Defined in
Methods
call()
call(endpoint, args)
call<
T
>(endpoint
,args
):Promise
<T
>
Utility method to call an endpoint without having to use Actions.
Type Parameters
• T extends IParsedResponse
Parameters
• endpoint: NavigationEndpoint
• args
• args.parse: true
Returns
Promise
<T
>
Defined in
call(endpoint, args)
call(
endpoint
,args
?):Promise
<ApiResponse
>
Parameters
• endpoint: NavigationEndpoint
• args?
• args.parse?: false
Returns
Promise
<ApiResponse
>
Defined in
download()
download(
video_id
,options
?):Promise
<ReadableStream
<Uint8Array
>>
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?: DownloadOptions
Download options.
Returns
Promise
<ReadableStream
<Uint8Array
>>
Defined in
getBasicInfo()
getBasicInfo(
video_id
,client
?):Promise
<VideoInfo
>
Parameters
• video_id: string
• client?: InnerTubeClient
Returns
Promise
<VideoInfo
>
Defined in
getChannel()
getChannel(
id
):Promise
<Channel
>
Parameters
• id: string
Returns
Promise
<Channel
>
Defined in
getChannelsFeed()
getChannelsFeed():
Promise
<Feed
<IBrowseResponse
>>
Returns
Promise
<Feed
<IBrowseResponse
>>
Defined in
getComments()
getComments(
video_id
,sort_by
?,comment_id
?):Promise
<Comments
>
Parameters
• video_id: string
• sort_by?: "TOP_COMMENTS"
| "NEWEST_FIRST"
• comment_id?: string
Returns
Promise
<Comments
>
Defined in
getGuide()
getGuide():
Promise
<Guide
>
Retrieves YouTube's content guide.
Returns
Promise
<Guide
>
Defined in
getHashtag()
getHashtag(
hashtag
):Promise
<HashtagFeed
>
Parameters
• hashtag: string
Returns
Promise
<HashtagFeed
>
Defined in
getHistory()
getHistory():
Promise
<History
>
Returns
Promise
<History
>
Defined in
getHomeFeed()
getHomeFeed():
Promise
<HomeFeed
>
Returns
Promise
<HomeFeed
>
Defined in
getInfo()
getInfo(
target
,client
?):Promise
<VideoInfo
>
Parameters
• target: string
| NavigationEndpoint
• client?: InnerTubeClient
Returns
Promise
<VideoInfo
>
Defined in
getLibrary()
getLibrary():
Promise
<Library
>
Returns
Promise
<Library
>
Defined in
getNotifications()
getNotifications():
Promise
<NotificationsMenu
>
Returns
Promise
<NotificationsMenu
>
Defined in
getPlaylist()
getPlaylist(
id
):Promise
<Playlist
>
Parameters
• id: string
Returns
Promise
<Playlist
>
Defined in
getPlaylists()
getPlaylists():
Promise
<Feed
<IBrowseResponse
>>
Retrieves the user's playlists.
Returns
Promise
<Feed
<IBrowseResponse
>>
Defined in
getSearchSuggestions()
getSearchSuggestions(
query
):Promise
<string
[]>
Parameters
• query: string
Returns
Promise
<string
[]>
Defined in
getShortsVideoInfo()
getShortsVideoInfo(
video_id
,client
?):Promise
<ShortFormVideoInfo
>
Parameters
• video_id: string
• client?: InnerTubeClient
Returns
Promise
<ShortFormVideoInfo
>
Defined in
getStreamingData()
getStreamingData(
video_id
,options
):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.
Parameters
• video_id: string
The video id.
• options: FormatOptions
= {}
Format options.
Returns
Promise
<Format
>
Defined in
getSubscriptionsFeed()
getSubscriptionsFeed():
Promise
<Feed
<IBrowseResponse
>>
Returns
Promise
<Feed
<IBrowseResponse
>>
Defined in
getTrending()
getTrending():
Promise
<TabbedFeed
<IBrowseResponse
>>
Returns
Promise
<TabbedFeed
<IBrowseResponse
>>
Defined in
getUnseenNotificationsCount()
getUnseenNotificationsCount():
Promise
<number
>
Returns
Promise
<number
>
Defined in
resolveURL()
resolveURL(
url
):Promise
<NavigationEndpoint
>
Resolves the given URL.
Parameters
• url: string
Returns
Promise
<NavigationEndpoint
>
Defined in
search()
search(
query
,filters
):Promise
<Search
>
Parameters
• query: string
• filters: SearchFilters
= {}
Returns
Promise
<Search
>
Defined in
create()
static
create(config
):Promise
<Innertube
>
Parameters
• config: SessionOptions
= {}
Returns
Promise
<Innertube
>