
Enables usage of the YouTube Music API, optionally with user authentication. Offers interfaces for direct API access and custom implementation, featuring example usage guidance.
A Kotlin Multiplatform library for (unofficially) using the YouTube Music API, optionally with user authentication. This library was originally a part of SpMp.
ytm-kt currently supports the following Kotlin targets:
repositories {
mavenCentral()
}
<version> with the desired ytm-kt version)implementation("dev.toastbits.ytmkt:ytmkt:<version>")
API endpoints are accessed through the YtmApi interface. To use this interface, either implement it yourself or use one of the built-in implementations:
// Initialise the Youtubei api implementation
val api: YtmApi =
YoutubeiApi(
data_language = "en-GB" // The language we want data (such as song names) to be in
)
// Download the home page recommendations feed
val song_feed_result: Result<SongFeedLoadResult> = api.SongFeed.getSongFeed()
// Print feed row titles in our desired language
for (layout in song_feed_result.getOrThrow().layouts) {
val title_text: String = layout.title.getString("en-GB") // The language we want UI strings to be in
println("Layout $title_text has ${layout.items.size} items")
}
TODO
A Kotlin Multiplatform library for (unofficially) using the YouTube Music API, optionally with user authentication. This library was originally a part of SpMp.
ytm-kt currently supports the following Kotlin targets:
repositories {
mavenCentral()
}
<version> with the desired ytm-kt version)implementation("dev.toastbits.ytmkt:ytmkt:<version>")
API endpoints are accessed through the YtmApi interface. To use this interface, either implement it yourself or use one of the built-in implementations:
// Initialise the Youtubei api implementation
val api: YtmApi =
YoutubeiApi(
data_language = "en-GB" // The language we want data (such as song names) to be in
)
// Download the home page recommendations feed
val song_feed_result: Result<SongFeedLoadResult> = api.SongFeed.getSongFeed()
// Print feed row titles in our desired language
for (layout in song_feed_result.getOrThrow().layouts) {
val title_text: String = layout.title.getString("en-GB") // The language we want UI strings to be in
println("Layout $title_text has ${layout.items.size} items")
}
TODO