import Session from './core/Session.js'; import { Kids, Music, Studio } from './core/clients/index.js'; import { AccountManager, InteractionManager, PlaylistManager } from './core/managers/index.js'; import { Feed } from './core/mixins/index.js'; import { Channel, Comments, Guide, HashtagFeed, History, HomeFeed, Library, NotificationsMenu, Playlist, Search, VideoInfo } from './parser/youtube/index.js'; import { ShortFormVideoInfo } from './parser/ytshorts/index.js'; import NavigationEndpoint from './parser/classes/NavigationEndpoint.js'; import type Format from './parser/classes/misc/Format.js'; import type { ApiResponse } from './core/Actions.js'; import type { DownloadOptions, EngagementType, FormatOptions, GetVideoInfoOptions, InnerTubeClient, InnerTubeConfig, SearchFilters } from './types/index.js'; import type { IBrowseResponse, IParsedResponse } from './parser/index.js'; /** * Provides access to various services and modules in the YouTube API. * * @example * ```ts * import { Innertube, UniversalCache } from 'youtubei.js'; * const innertube = await Innertube.create({ cache: new UniversalCache(true)}); * ``` */ export default class Innertube { #private; constructor(session: Session); static create(config?: InnerTubeConfig): Promise; getInfo(target: string | NavigationEndpoint, options?: GetVideoInfoOptions): Promise; getBasicInfo(video_id: string, options?: GetVideoInfoOptions): Promise; getShortsVideoInfo(video_id: string, client?: InnerTubeClient): Promise; search(query: string, filters?: SearchFilters): Promise; getSearchSuggestions(query: string, previous_query?: string): Promise; getComments(video_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST', comment_id?: string): Promise; getHomeFeed(): Promise; getGuide(): Promise; getLibrary(): Promise; getHistory(): Promise; getCourses(): Promise>; getSubscriptionsFeed(): Promise>; getChannelsFeed(): Promise>; getChannel(id: string): Promise; getNotifications(): Promise; getUnseenNotificationsCount(): Promise; /** * Retrieves the user's playlists. */ getPlaylists(): Promise>; getPlaylist(id: string): Promise; getHashtag(hashtag: string): Promise; /** * An alternative to {@link download}. * Returns deciphered streaming data. * * If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}. * @param video_id - The video id. * @param options - Format options. */ getStreamingData(video_id: string, options?: FormatOptions): Promise; /** * Downloads a given video. If all you need the direct download link, see {@link getStreamingData}. * If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}. * @param video_id - The video id. * @param options - Download options. */ download(video_id: string, options?: DownloadOptions): Promise>; /** * Resolves the given URL. */ resolveURL(url: string): Promise; /** * Gets a post page given a post id and the channel id */ getPost(post_id: string, channel_id: string): Promise>; /** * Gets the comments of a post. */ getPostComments(post_id: string, channel_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST'): Promise; /** * Fetches an attestation challenge. */ getAttestationChallenge(engagement_type: EngagementType, ids?: Record[]): Promise; /** * Utility method to call an endpoint without having to use {@link Actions}. */ call(endpoint: NavigationEndpoint, args: { [key: string]: any; parse: true; }): Promise; call(endpoint: NavigationEndpoint, args?: { [key: string]: any; parse?: false; }): Promise; /** * An interface for interacting with YouTube Music. */ get music(): Music; /** * An interface for interacting with YouTube Studio. */ get studio(): Studio; /** * An interface for interacting with YouTube Kids. */ get kids(): Kids; /** * An interface for managing and retrieving account information. */ get account(): AccountManager; /** * An interface for managing playlists. */ get playlist(): PlaylistManager; /** * An interface for directly interacting with certain YouTube features. */ get interact(): InteractionManager; /** * An internal class used to dispatch requests. */ get actions(): import("./core/Actions.js").default; /** * The session used by this instance. */ get session(): Session; }