HaarigerHarald/android-youtubeExtractor


Deprecated: Android based YouTube URL extractor and downloader

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.haarigerharald:android-youtubeextractor:2.1.0'
	}
	dependencies {
		implementation("com.github.haarigerharald:android-youtubeextractor:2.1.0")
	}
	<dependency>
	    <groupId>com.github.haarigerharald</groupId>
	    <artifactId>android-youtubeextractor</artifactId>
	    <version>2.1.0</version>
	</dependency>

                            
    libraryDependencies += "com.github.haarigerharald" % "android-youtubeextractor" % "2.1.0"
        
        

                            
    :dependencies [[com.github.haarigerharald/android-youtubeextractor "2.1.0"]]
        
        

Readme


Android based YouTube url extractor

These are the urls to the YouTube video or audio files, so you can stream or download them. It features an age verification circumvention and a signature deciphering method (mainly for vevo videos).

Gradle

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

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

And the dependency:

implementation 'com.github.HaarigerHarald:android-youtubeExtractor:master-SNAPSHOT'

Usage

It's build around an AsyncTask. Called from an Activity you can write:

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

new YouTubeExtractor(this) {
    @Override
    public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
        if (ytFiles != null) {
            int itag = 22;
	    String downloadUrl = ytFiles.get(itag).getUrl();
        }
    }
}.extract(youtubeLink);

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

Requirements

Android 4.0 (API version 14) and up for Webview Javascript execution see: js-evaluator-for-android. Not signature enciphered Videos may work on lower Android versions (untested).

Limitations

Those videos aren't working:

  • Age restricted videos
  • 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.

  • advancedDownloader: A more sophisticated App using the mp4parser library to mux dash audio and video files together and add metadata to audio files after downloading. youtubeDownloader.apk

<img height="0" width="4%"> <img src='Screenshot_2015-04-26-17-04-382.png' width='30%'> <img height="0" width="10%"> <img src='Screenshot_2015-04-27-17-05-50.png' width='30%'> <img height="0" width="15%">

License

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