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 a complete set of authenticated playlist management methods on the YouTube object. All write operations require a valid session cookie.
All playlist write operations (createPlaylist, addToPlaylist, removeFromPlaylist, etc.) require authentication. Set YouTube.cookie with a valid YouTube Music session cookie before calling these methods.
YouTube.cookie = "SAPISID=xxxxx; __Secure-3PAPISID=xxxxx; ..."

Creating playlists

YouTube.createPlaylist(title) creates a new empty playlist and returns Result<String>. The unwrapped value is the new playlist’s ID string (e.g. PLxxxxxx) from the CreatePlaylistResponse.
val playlistId = YouTube.createPlaylist("My Workout Mix").getOrThrow()
println("Created playlist: $playlistId")

Renaming and deleting

YouTube.renamePlaylist(playlistId, name) renames an existing playlist. YouTube.deletePlaylist(playlistId) permanently deletes it. Both return Result<Unit>-equivalent results (the inner Unit is the HTTP response body, which you can ignore).
YouTube.renamePlaylist("PLxxxxxx", "My Updated Mix").getOrThrow()
YouTube.deletePlaylist("PLxxxxxx").getOrThrow()

Adding tracks

YouTube.addToPlaylist(playlistId, videoId) appends a single track to a playlist and returns Result<String?> — the setVideoId assigned to the new entry, or null if unavailable. YouTube.addPlaylistToPlaylist(playlistId, addPlaylistId) appends all tracks from another playlist into the target playlist.
// Add a single track
val setVideoId = YouTube.addToPlaylist("PLxxxxxx", "dQw4w9WgXcQ").getOrThrow()
println("New setVideoId: $setVideoId")

// Merge another playlist into this one
YouTube.addPlaylistToPlaylist("PLxxxxxx", "PLyyyyyy").getOrThrow()

Removing and reordering tracks

YouTube.removeFromPlaylist(playlistId, videoId, setVideoId) removes a specific entry from a playlist. YouTube.moveSongPlaylist(playlistId, setVideoId, successorSetVideoId) reorders an entry by placing it immediately before the entry identified by successorSetVideoId (pass null to move the track to the end of the playlist). The setVideoId is a per-entry identifier that is distinct from the video ID — it scopes the entry to a specific position within a specific playlist. It is available on SongItem.setVideoId for songs fetched from a PlaylistPage or PlaylistContinuationPage.
1

Fetch the playlist

Retrieve the playlist to get the current setVideoId values for each track.
val playlist = YouTube.playlist("PLxxxxxx").getOrThrow()
val firstSong = playlist.songs.first()
val thirdSong = playlist.songs[2]
2

Remove a track

Pass the playlist ID, the track’s video ID, and its setVideoId.
YouTube.removeFromPlaylist(
    playlistId = "PLxxxxxx",
    videoId = firstSong.id,
    setVideoId = firstSong.setVideoId!!
).getOrThrow()
3

Reorder a track

Move a track to just before another track by providing both their setVideoId values.
YouTube.moveSongPlaylist(
    playlistId = "PLxxxxxx",
    setVideoId = firstSong.setVideoId!!,
    successorSetVideoId = thirdSong.setVideoId
).getOrThrow()

Looking up setVideoId

If you only know the videoId of a track (and not its setVideoId), use YouTube.playlistEntrySetVideoIds(playlistId, videoId) which pages through the entire playlist and returns Result<List<String>> — all setVideoId values for occurrences of that video ID (a video can appear multiple times in the same playlist).
val setVideoIds = YouTube.playlistEntrySetVideoIds("PLxxxxxx", "dQw4w9WgXcQ").getOrThrow()
// Use the first match
val setVideoId = setVideoIds.firstOrNull()
if (setVideoId != null) {
    YouTube.removeFromPlaylist("PLxxxxxx", "dQw4w9WgXcQ", setVideoId).getOrThrow()
}

Liking playlists

YouTube.likePlaylist(playlistId, like) saves (like = true) or unsaves (like = false) a playlist to the user’s library.
// Save a playlist to your library
YouTube.likePlaylist("PLxxxxxx", like = true).getOrThrow()

// Remove it from your library
YouTube.likePlaylist("PLxxxxxx", like = false).getOrThrow()
Always fetch the playlist with YouTube.playlist() immediately before performing remove or move operations to get up-to-date setVideoId values — they can change whenever the playlist is modified by any client.

Build docs developers (and LLMs) love