
Extracts YouTube video information such as titles, descriptions, and streaming URLs, with built-in retry for data fetching. Supports Android, Desktop, and other platforms.
A Kotlin Multiplatform (KMP) library for extracting YouTube video information. Supports Android, Desktop, and other KMP-compatible platforms. iOS support is planned but not yet implemented.
Add the Maven repository to your repositories section in your project's build script.
In your build.gradle.kts file:
repositories {
mavenCentral()
google() //android only
}Add the library dependency to your respective modules.
dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor-android:1.0.2")
}dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor-desktop:1.0.2")
}kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor:1.0.2")
}
}
}
}To use the YouTubeExtractor library, call the extractVideoData function:
fun main() {
val youtubeExtractor = YouTubeExtractor()
val url = "https://www.youtube.com/watch?v=GT0rV3pV2fA"
youtubeExtractor.extractVideoData(url).onSuccess{
println("video Title = > ${it.videoDetails?.title}")
println("video description = > ${it.videoDetails?.shortDescription}")
println("static Format url = > ${it.streamingData?.formats?.first()}")
println("hls url :: ${it.streamingData.hlsManifestUrl}")
}.onError{ //error ->
//error message
}
}
We welcome contributions! Feel free to submit issues or pull requests to improve the library.
If you have any feedback, please reach out to us at dhattarwal.singh@gmail.com
A Kotlin Multiplatform (KMP) library for extracting YouTube video information. Supports Android, Desktop, and other KMP-compatible platforms. iOS support is planned but not yet implemented.
Add the Maven repository to your repositories section in your project's build script.
In your build.gradle.kts file:
repositories {
mavenCentral()
google() //android only
}Add the library dependency to your respective modules.
dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor-android:1.0.2")
}dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor-desktop:1.0.2")
}kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.ajaydhattarwal:youtube-extractor:1.0.2")
}
}
}
}To use the YouTubeExtractor library, call the extractVideoData function:
fun main() {
val youtubeExtractor = YouTubeExtractor()
val url = "https://www.youtube.com/watch?v=GT0rV3pV2fA"
youtubeExtractor.extractVideoData(url).onSuccess{
println("video Title = > ${it.videoDetails?.title}")
println("video description = > ${it.videoDetails?.shortDescription}")
println("static Format url = > ${it.streamingData?.formats?.first()}")
println("hls url :: ${it.streamingData.hlsManifestUrl}")
}.onError{ //error ->
//error message
}
}
We welcome contributions! Feel free to submit issues or pull requests to improve the library.
If you have any feedback, please reach out to us at dhattarwal.singh@gmail.com