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.

Inner provides methods to access a user’s personal YouTube Music library — liked songs, saved playlists, listening history, and recently played items. All library methods require authentication.
Library methods require a valid YouTube Music session cookie. Set YouTube.cookie before calling these methods.
YouTube.cookie = "SAPISID=xxxxx; __Secure-3PAPISID=xxxxx; ..."

Library overview

YouTube.library(browseId, tabIndex) browses any library section by its InnerTube browse ID and returns Result<LibraryPage>. The LibraryPage data class contains:
  • items: List<YTItem> — the content items on this page (playlists, albums, artists, or songs depending on the browse ID)
  • continuation: String? — token for the next page
Common library browse IDs:
Browse IDContents
FEmusic_library_landingLibrary home (recently active content)
FEmusic_liked_videosLiked songs
FEmusic_liked_playlistsSaved playlists
FEmusic_library_corpus_artistsSaved artists
// Browse the library landing page
val library = YouTube.library("FEmusic_library_landing").getOrThrow()
library.items.forEach { item ->
    println(item.title)
}

Library filters

YouTube.library() accepts the tabIndex parameter (default 0) to select a tab in the response. To filter results within a library section by sort order or recency, pass a LibraryFilter continuation value via YouTube.libraryContinuation():
Filter constantDescription
LibraryFilter.FILTER_RECENT_ACTIVITYRecently active items
LibraryFilter.FILTER_RECENTLY_PLAYEDRecently played tracks
LibraryFilter.FILTER_PLAYLISTS_ALPHABETICALPlaylists sorted A–Z
LibraryFilter.FILTER_PLAYLISTS_RECENTLY_SAVEDRecently saved playlists
Each LibraryFilter constant is a @JvmInline value class wrapping the InnerTube continuation parameter string. Pass the .value property as the continuation argument to libraryContinuation() to load a filtered view:
import com.tamed.music.innertube.YouTube.LibraryFilter

val filtered = YouTube.libraryContinuation(
    LibraryFilter.FILTER_PLAYLISTS_ALPHABETICAL.value
).getOrThrow()
filtered.items.forEach { println(it.title) }

Library pagination

YouTube.libraryContinuation(continuation) returns Result<LibraryContinuationPage> with items: List<YTItem> and continuation: String?. Use it to page through large library sections:
var page = YouTube.library("FEmusic_liked_videos").getOrThrow()
val allSongs = page.items.toMutableList()
while (page.continuation != null) {
    page.items.forEach { println(it.title) }
    val next = YouTube.libraryContinuation(page.continuation!!).getOrThrow()
    allSongs += next.items
    // Build a new page-like object for the loop check
    page = com.tamed.music.innertube.pages.LibraryPage(
        items = next.items,
        continuation = next.continuation
    )
}
println("Total liked songs: ${allSongs.size}")

Recent activity

YouTube.libraryRecentActivity() returns Result<LibraryPage> for the most recently active items across the library. Internally this uses the FILTER_RECENT_ACTIVITY continuation value. For ArtistItem entries, it additionally fetches each artist page to populate the playEndpoint field.
val recent = YouTube.libraryRecentActivity().getOrThrow()
recent.items.forEach { item ->
    println("${item.title} (${item::class.simpleName})")
}

Listening history

YouTube.musicHistory() browses FEmusic_history and returns Result<HistoryPage>. The HistoryPage data class contains:
  • sections: List<HistorySection>? — time-bucketed sections (e.g. “Today”, “Yesterday”, “This week”). Each HistorySection has title: String and songs: List<SongItem>.
val history = YouTube.musicHistory().getOrThrow()
history.sections?.forEach { section ->
    println("=== ${section.title} ===")
    section.songs.forEach { song ->
        println("  ${song.title}${song.artists.firstOrNull()?.name}")
    }
}

Liking songs

YouTube.likeVideo(videoId, like) likes (like = true) or unlikes (like = false) a song, adding it to or removing it from the user’s liked songs library.
// Like a song
YouTube.likeVideo("dQw4w9WgXcQ", like = true).getOrThrow()

// Unlike a song
YouTube.likeVideo("dQw4w9WgXcQ", like = false).getOrThrow()

Subscribing to artists

YouTube.subscribeChannel(channelId, subscribe) subscribes to (subscribe = true) or unsubscribes from (subscribe = false) an artist channel. The channelId is available from ArtistItem.channelId (distinct from the browse ID).
// Subscribe to an artist
YouTube.subscribeChannel("UCxxxxxx", subscribe = true).getOrThrow()

// Unsubscribe
YouTube.subscribeChannel("UCxxxxxx", subscribe = false).getOrThrow()
ArtistItem.channelId and ArtistItem.id (the browse ID) are different identifiers. The channelId (required for subscribe/unsubscribe) is populated from the subscribe button on the artist page — fetch it via YouTube.artist(browseId) if it is not already present.

Account info

YouTube.accountInfo() returns Result<AccountInfo> with the logged-in user’s details:
FieldTypeDescription
nameStringDisplay name
emailString?Google account email
channelHandleString?YouTube channel handle (e.g. @username)
thumbnailUrlString?Profile photo URL
val account = YouTube.accountInfo().getOrThrow()
println("Logged in as: ${account.name}")
account.channelHandle?.let { println("Handle: $it") }
If the user is not logged in (no valid cookie), accountInfo() throws an IllegalStateException with the message "Failed to get account info - user may not be logged in".

Build docs developers (and LLMs) love