Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/faraasaaay/inner/llms.txt

Use this file to discover all available pages before exploring further.

User action methods on YouTube require a valid session cookie. They cover liking content, subscribing to artists, managing playlists, and fetching account information. All methods are suspend functions returning Result<T>.
All methods in this section require YouTube.cookie to be set with a valid YouTube Music session cookie. Calls made without a valid cookie will fail with an authentication error from the InnerTube API.

Liking content

likeVideo(videoId, like)

Likes or unlikes a video.
// Like a video
YouTube.likeVideo("dQw4w9WgXcQ", like = true)
    .onSuccess { println("Liked!") }
    .onFailure { println("Error: ${it.message}") }

// Unlike a video
YouTube.likeVideo("dQw4w9WgXcQ", like = false)
videoId
String
required
The YouTube video ID to like or unlike.
like
Boolean
required
true to like the video; false to remove the like.

likePlaylist(playlistId, like)

Likes or unlikes a playlist (saves or unsaves it to the user’s library).
YouTube.likePlaylist("PLxxx", like = true)
    .onSuccess { println("Playlist saved!") }
playlistId
String
required
The playlist ID.
like
Boolean
required
true to like/save the playlist; false to remove it.

Subscribing

subscribeChannel(channelId, subscribe)

Subscribes to or unsubscribes from a YouTube channel.
// Get channel ID from an artist's browse ID first
val channelId = YouTube.getChannelId("UCT9zcQNlyht7fRlcjmflRSA")

// Subscribe
YouTube.subscribeChannel(channelId, subscribe = true)
    .onSuccess { println("Subscribed!") }

// Unsubscribe
YouTube.subscribeChannel(channelId, subscribe = false)
channelId
String
required
The YouTube channel ID (format: UC...). This is distinct from the artist browse ID — use getChannelId() to resolve it.
subscribe
Boolean
required
true to subscribe; false to unsubscribe.

getChannelId(browseId)

Helper that resolves a channel ID from an artist page’s browse ID. Internally calls artist() and returns ArtistItem.channelId.
val channelId = YouTube.getChannelId("UCT9zcQNlyht7fRlcjmflRSA")
println("Channel ID: $channelId")
browseId
String
required
The artist’s InnerTube browse ID (format: UC...).
String
String
The channel ID string, or an empty string if the artist page could not be fetched or has no channelId.
getChannelId is a suspend function but does not return Result<T> — it returns a raw String. Errors are swallowed and an empty string is returned instead. Check for an empty result before calling subscribeChannel.

Playlist management

createPlaylist(title)

Creates a new empty playlist in the user’s YouTube Music library.
val playlistId = YouTube.createPlaylist("My Road Trip Mix").getOrThrow()
println("Created playlist: $playlistId")
title
String
required
Display name for the new playlist.
String
String
The newly created playlist’s ID.

renamePlaylist(playlistId, name)

Renames an existing playlist.
YouTube.renamePlaylist("PLxxx", "Updated Playlist Name")
    .onSuccess { println("Renamed!") }
playlistId
String
required
ID of the playlist to rename.
name
String
required
New display name.

deletePlaylist(playlistId)

Permanently deletes a playlist from the user’s library.
YouTube.deletePlaylist("PLxxx")
    .onSuccess { println("Deleted.") }
playlistId
String
required
ID of the playlist to delete.

addToPlaylist(playlistId, videoId)

Adds a single video to a playlist and returns the setVideoId of the new entry (needed for removal and reordering).
val setVideoId = YouTube.addToPlaylist("PLxxx", "dQw4w9WgXcQ").getOrThrow()
println("Added with setVideoId: $setVideoId")
playlistId
String
required
Target playlist ID.
videoId
String
required
Video ID to add.
String?
String?
The setVideoId assigned to the new playlist entry. Required for removeFromPlaylist and moveSongPlaylist.

addPlaylistToPlaylist(playlistId, addPlaylistId)

Appends all songs from one playlist into another.
YouTube.addPlaylistToPlaylist(
    playlistId = "PLtarget",
    addPlaylistId = "PLsource"
).onSuccess { println("Songs added!") }
playlistId
String
required
The destination playlist ID.
addPlaylistId
String
required
The source playlist whose songs will be appended.

removeFromPlaylist(playlistId, videoId, setVideoId)

Removes a specific playlist entry by its setVideoId.
// You need the setVideoId — use playlistEntrySetVideoIds() to look it up
val setVideoIds = YouTube.playlistEntrySetVideoIds("PLxxx", "dQw4w9WgXcQ").getOrThrow()
setVideoIds.forEach { setVideoId ->
    YouTube.removeFromPlaylist("PLxxx", "dQw4w9WgXcQ", setVideoId)
        .onSuccess { println("Removed entry $setVideoId") }
}
playlistId
String
required
The playlist to modify.
videoId
String
required
Video ID of the track to remove.
setVideoId
String
required
The unique entry identifier within the playlist. Returned by addToPlaylist() or looked up via playlistEntrySetVideoIds().

moveSongPlaylist(playlistId, setVideoId, successorSetVideoId)

Reorders a playlist entry, placing it immediately before the entry identified by successorSetVideoId.
YouTube.moveSongPlaylist(
    playlistId = "PLxxx",
    setVideoId = "currentEntrySetVideoId",
    successorSetVideoId = "nextEntrySetVideoId" // null to move to end
).onSuccess { println("Reordered!") }
playlistId
String
required
The playlist to modify.
setVideoId
String
required
The setVideoId of the entry to move.
successorSetVideoId
String?
required
The setVideoId of the entry that should follow the moved entry. Pass null to move the entry to the end of the playlist.

playlistEntrySetVideoIds(playlistId, videoId)

Looks up all setVideoId values for occurrences of a given videoId within a playlist. Handles pagination automatically.
val setVideoIds = YouTube.playlistEntrySetVideoIds("PLxxx", "dQw4w9WgXcQ").getOrThrow()
println("Found ${setVideoIds.size} occurrence(s) in playlist")
playlistId
String
required
The playlist to search.
videoId
String
required
Video ID to look up.
List<String>
List<String>
Distinct setVideoId values for all occurrences of videoId in the playlist.

Library

library(browseId, tabIndex)

Fetches the user’s library for a given browse destination. The returned LibraryPage contains either grid-style items (playlists, albums) or list-style items (songs), depending on the browse destination.
YouTube.library("FEmusic_liked_playlists", tabIndex = 0)
    .onSuccess { page ->
        page.items.forEach { println(it) }
        println("Continuation: ${page.continuation}")
    }
browseId
String
required
InnerTube browse ID for the library section (e.g. FEmusic_liked_playlists).
tabIndex
Int
default:"0"
Zero-based tab index when the browse destination has multiple tabs.
LibraryPage
object

libraryContinuation(continuation)

Loads the next page of library items.
val page = YouTube.library("FEmusic_liked_playlists").getOrThrow()
val morePage = page.continuation?.let {
    YouTube.libraryContinuation(it).getOrThrow()
}
morePage?.items?.forEach { println(it) }
continuation
String
required
Continuation token from LibraryPage.continuation.
LibraryContinuationPage
object

libraryRecentActivity()

Fetches the user’s recently interacted-with content using LibraryFilter.FILTER_RECENT_ACTIVITY. Also enriches any ArtistItem results with a proper playEndpoint by fetching each artist page individually.
val page = YouTube.libraryRecentActivity().getOrThrow()
page.items.forEach { println(it) }
LibraryPage
object
Same shape as library() but fetched via the recent-activity continuation filter.

musicHistory()

Fetches the user’s play history page (FEmusic_history), grouped into time-based sections (Today, Yesterday, etc.).
YouTube.musicHistory()
    .onSuccess { history ->
        history.sections?.forEach { section ->
            println("${section.title}: ${section.songs.size} tracks")
        }
    }
HistoryPage
object

accountInfo()

Fetches the display name, handle, and avatar for the currently signed-in account.
val account = YouTube.accountInfo().getOrThrow()
println("Signed in as: ${account.name}")
println("Handle: ${account.email}")
AccountInfo
object
Account metadata parsed from the account menu response. Throws IllegalStateException if the user is not signed in.

LibraryFilter values

YouTube.LibraryFilter is a @JvmInline value class wrapping an encoded continuation string used to filter library browse requests.
ConstantDescription
FILTER_RECENT_ACTIVITYItems you have recently interacted with (plays, likes, saves). Used by libraryRecentActivity().
FILTER_RECENTLY_PLAYEDItems sorted by most recently played.
FILTER_PLAYLISTS_ALPHABETICALLiked playlists sorted A → Z.
FILTER_PLAYLISTS_RECENTLY_SAVEDLiked playlists sorted by most recently saved.
LibraryFilter values are passed as continuation tokens to the browse endpoint rather than as query parameters. They are used internally by libraryRecentActivity() and can be passed directly to libraryContinuation() to trigger filtered library views.

Build docs developers (and LLMs) love