This guide walks you through adding InnerTube to an Android project, configuring theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/innertube-v2/llms.txt
Use this file to discover all available pages before exploring further.
YouTube object, and running your first real API calls.
Every
YouTube method is a suspend function. All calls must be made from a coroutine scope — for example inside viewModelScope.launch { }, lifecycleScope.launch { }, or a runBlocking { } block during testing.Add the Module
InnerTube is distributed as a local Android library module, not a Maven artifact. Clone or copy the The library requires core library desugaring (already configured in the module itself). Ensure your app module also has it enabled if your After syncing Gradle, you can import
innertube/ directory into your project root, then wire it up in your Gradle files.settings.gradle.kts — include the module:settings.gradle.kts
app/build.gradle.kts — add the module dependency:app/build.gradle.kts
minSdk is below 26:app/build.gradle.kts
com.music.innertube.YouTube anywhere in your app code.Configure the YouTube Object
Before making any API calls, set the locale so responses return content in the right language and region. The locale defaults to the device’s system locale, but you should set it explicitly for predictable behaviour:For guest browsing (no account), fetch a
visitorData token. This is an anonymous session identifier that improves response quality and is required for some endpoints:refreshVisitorData() fetches a fresh token from YouTube and automatically stores it in YouTube.visitorData — you don’t need to assign it manually.Search for Music
Use Available
YouTube.search() with one of the built-in SearchFilter constants to search for songs, albums, artists, videos, or playlists.SearchFilter constants:| Filter | Content type |
|---|---|
SearchFilter.FILTER_SONG | Audio tracks |
SearchFilter.FILTER_VIDEO | Music videos |
SearchFilter.FILTER_ALBUM | Albums & EPs |
SearchFilter.FILTER_ARTIST | Artist channels |
SearchFilter.FILTER_FEATURED_PLAYLIST | Curated playlists |
SearchFilter.FILTER_COMMUNITY_PLAYLIST | User playlists |
Fetch an Artist Page
Pass an artist The
browseId (e.g. UCiMhD4jzUqG-IgPzUmmZifg) to YouTube.artist() to retrieve an ArtistPage containing the artist’s metadata and content sections.ArtistPage.artist field also exposes shuffleEndpoint and radioEndpoint — pass these to YouTube.next() to start a shuffle or radio queue for the artist.Resolve a Player Stream
Use Available
YouTube.player() to fetch a PlayerResponse containing stream URLs and playback metadata for a given video ID.Some stream URLs are cipher-protected. If
format.url is null and format.signatureCipher is present, pass the response through YouTube.newPipePlayer() or use YouTubeExtractor.decryptUrl() to resolve the final playable URL.YouTubeClient constants for player():| Client | Notes |
|---|---|
YouTubeClient.WEB_REMIX | Primary YouTube Music client. Supports login and PoToken. |
YouTubeClient.ANDROID_VR_1_61_48 | No login required; useful for unauthenticated playback. |
YouTubeClient.TVHTML5_SIMPLY_EMBEDDED_PLAYER | Bypasses age restrictions without login. |
YouTubeClient.IOS | iOS client; no signature timestamp required. |
Warm Up the Extractor at App Start
Next Steps
- Configuration — Set locale, cookie authentication, proxy, and IP version.
- The YouTube Object — Explore every method on the
YouTubesingleton. - Search API — Deep-dive into filters, pagination, and result types.