Documentation 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.
YouTubeUrlParser is a Kotlin object utility for recognizing and extracting identifiers from YouTube and YouTube Music URLs. It returns typed ParsedUrl sealed class results so you can dispatch on the type of content the URL points to without manual string parsing.
object YouTubeUrlParser
ParsedUrl — Sealed Class
ParsedUrl is the return type of parse(). It has two concrete subtypes.
ParsedUrl.Video
id is the 11-character YouTube video ID.
ParsedUrl.Artist
id is the channel browse ID (e.g. UCxxxxxx) or an album/artist browse ID (e.g. MPRExxxxxx).
YouTubeUrlParser.parse(url: String): ParsedUrl?
null if the URL is not recognized.
Supported video URL patterns:
| Pattern | Example |
|---|---|
| YouTube Music watch URL | https://music.youtube.com/watch?v=VIDEO_ID |
| YouTube watch URL | https://www.youtube.com/watch?v=VIDEO_ID |
| Short link | https://youtu.be/VIDEO_ID |
| YouTube Shorts | https://www.youtube.com/shorts/VIDEO_ID |
| Pattern | Example |
|---|---|
| Channel URL | https://music.youtube.com/channel/UCxxxxxx |
| Browse URL (album/artist) | https://music.youtube.com/browse/MPRExxxxxxxx |
Artist URL matching is restricted to
music.youtube.com domains. Standard youtube.com/channel/... URLs are not matched as artists.YouTubeUrlParser.isYouTubeUrl(text: String): Boolean
true if the text is a recognized YouTube or YouTube Music URL (i.e. parse() would return a non-null result). Useful for detecting URLs pasted by users.
YouTubeUrlParser.extractVideoId(url: String): String?
url is a video URL, or null for artist URLs and unrecognized inputs.
Equivalent to:
YouTubeUrlParser.createWatchEndpoint(url: String): WatchEndpoint?
WatchEndpoint(videoId = ...) from a video URL. Returns null if the URL is not a video URL.
Useful for passing directly to YouTube.next() or YouTube.player().