InnerTube is distributed as a local Android library module — there is no Maven artifact to download. The steps below walk you through cloning the repository into your project, wiring up the Gradle dependency, and running your first search against the YouTube Music API.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/innertube-v1/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- An Android project using Kotlin (not Java).
minSdkset to 26 or higher in your app module’sbuild.gradle.kts.- Kotlin coroutines available (the library’s public API is entirely
suspend-based).
Installation
Clone or copy the innertube module into your project
Place the
innertube directory at the root of your Android project alongside your app module. Your project structure should look like:Register the module in settings.gradle.kts
Open your root
settings.gradle.kts and include the module:The
innertube module uses core library desugaring (isCoreLibraryDesugaringEnabled = true). If your app module does not already have desugaring enabled, add coreLibraryDesugaring(libs.desugaring) to your app’s dependencies as well.Your first API call
Once the module is on the classpath, you can use theYouTube singleton object directly. All methods are suspend functions and must be called from a coroutine scope.
Configure the locale
Set the locale before making any API calls. Thegl field is an ISO 3166-1 alpha-2 country code and hl is a BCP 47 language tag:
(Optional) Attach a visitor ID
YouTube assigns a visitor data token that improves personalisation and reduces the chance of bot-detection challenges. You can fetch one directly from YouTube’s servers:Search for songs
CallYouTube.search() with a query string and one of the SearchFilter constants. The method returns Result<SearchResult>, where SearchResult.items is a List<YTItem> and SearchResult.continuation holds an opaque token for the next page of results.
Available search filters
Paginate search results
WhenSearchResult.continuation is non-null, call YouTube.searchContinuation() to fetch the next page:
Fetching an artist page
UseYouTube.artist() with a browse ID (the UCxxxxx-style channel identifier) to retrieve a complete ArtistPage:
Every
YouTube method returns Result<T>. Use getOrNull() to silently discard errors, getOrThrow() to propagate them as exceptions, or fold(onSuccess, onFailure) to handle both branches explicitly.Next steps
Once you are comfortable with search and browse calls, explore the rest of theYouTube API:
YouTube.album(browseId)— fetch a fullAlbumPageincluding song list and alternate versions.YouTube.playlist(playlistId)— load playlist metadata and its first page of tracks.YouTube.home()— fetch the personalised home feed with carousel sections and filter chips.YouTube.player(videoId, playlistId, ...)— resolve playback streams for a given video ID.YouTube.createPlaylist(title)— create a new playlist on the authenticated account.