Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Android based YouTube URL extractor and downloader

License

Notifications You must be signed in to change notification settings

arkon/android-youtubeExtractor

 
 

Repository files navigation

Android based YouTube url extractor

Fork of HaarigerHarald/android-youtubeExtractor

This fork features:

  • Kotlin coroutine instead of an AsyncTask
  • Removed deprecated APIs

These are the urls to the YouTube video or audio files, so you can stream or download them.

Requires Android 5.0 (API version 21) or higher.

Gradle

To always build from the latest commit with all updates. Add the JitPack repository:

repositories {
    maven { url "https://jitpack.io" }
}

And the dependency:

// Required dependency
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

implementation "com.github.arkon:android-youtubeExtractor:$version"

Usage

val youtubeLink = "http://youtube.com/watch?v=xxxx"

scope.launch {
    val result = YouTubeExtractor(context).extract(youtubeLink)
    result?.files?.let {
        val downloadUrl = it[22].url
        // ...
    }
    result?.metadata?.let {
        // ...
    }
}

files is a map of available media files for one YouTube video, accessible by their itag value. For further info about itags and their associated formats refer to: Wikipedia - YouTube Quality and formats.

Limitations

Those videos aren't working:

  • Everything private (private videos, bought movies, ...)
  • Unavailable in your country
  • RTMPE urls (very rare)

Modules

  • youtubeExtractor: The extractor android library.
  • sampleApp: A simple example downloader App.

License

Modified BSD license see LICENSE and 3rd party licenses depending on what you need

About

Android based YouTube URL extractor and downloader

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Kotlin 85.6%
  • Java 14.4%