Skip to content

Commit 62b0db0

Browse files
Add an advanced App
1 parent 96154e8 commit 62b0db0

23 files changed

+635
-16
lines changed

README.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ A small android based YouTube url extractor.
44
These are the literal urls to the YouTube video or audio files, so you can stream or download them.
55
It features an age verification circumvention and a signature deciphering method (mainly for vevo videos).
66

7-
I've made a little jar lib which should make integration super easy: [youtubeExtractor.jar](https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/bin/youtubeExtractor.jar)
7+
## Get it
88

9-
#### How to Use:
9+
1. Just import the jar library [youtubeExtractor.jar](https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/bin/youtubeExtractor.jar)
10+
11+
1. Or build it yourself from the sources, don't forget you will also need this great library if you do so: [js-evaluator-for-android](https://github.com/evgenyneu/js-evaluator-for-android)
12+
13+
## How to Use:
1014

1115
It's basically build around an AsyncTask. Called from an Activity you can write something like that:
1216

@@ -16,11 +20,8 @@ It's basically build around an AsyncTask. Called from an Activity you can write
1620
@Override
1721
public void onUrisAvailable(String videoId, String videoTitle, SparseArray<YtFile> ytFiles) {
1822
if(ytFiles!=null){
19-
int itag = 22;
20-
// itag is a YouTube format identifier, 22 for example is "mp4 h264 1280x720"
21-
23+
int itag = 22; // a YouTube format identifier
2224
String downloadUrl = ytFiles.get(itag).getUrl();
23-
// TODO: Do something cool with the "downloadUrl"...
2425
}
2526
}
2627
};
@@ -30,19 +31,27 @@ It's basically build around an AsyncTask. Called from an Activity you can write
3031
The important thing is the ytFiles SparseArray. Because YouTube videos are available in multiple formats we can choose one by
3132
calling ytFiles.get(itag). One ytFile contains the url and its appropriate meta data like: "mp4 1280x720" or "m4a dash aac"
3233

33-
For further infos have a look at the supplied sample YoutubeDownloader app. It uses the "Share" function in the official YouTube
34-
app to download YouTube videos. It doesn't have a launcher entry though so don't be irritated.
34+
For further infos have a look at the supplied sample YouTube Downloader app. It uses the "Share" function in the official YouTube
35+
app to download the files provided by YouTube. It doesn't have a launcher entry though so don't be irritated. [youtubeSampleDL.apk](https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/bin/youtubeSampleDL.apk)
3536

36-
To try the app have a look at: [youtubeDownloader.apk](https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/bin/youtubeSampleDL.apk)
37+
## Requirements
3738

38-
<img src='https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/Screenshot_2015-02-11-19-29-13.png' width='250' alt='youtubeDownloader Screenshot 1'>
39+
Android 3.0 and up for Webview Javascript execution see [js-evaluator-for-android](https://github.com/evgenyneu/js-evaluator-for-android)
3940

40-
<img src='https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/Screenshot_2015-02-10-15-12-45.png' width='250' alt='youtubeDownloader Screenshot 2'>
41+
Not enciphered Videos may work on lower Android versions (untested).
4142

42-
I'm using a useful lib for JavaScript execution, if you want to build your own lib from the sources head
43-
over to: https://github.com/evgenyneu/js-evaluator-for-android
43+
## Advanced YouTube Downloader App
4444

45-
Just to make it clear I'm not in any way related to YouTube!
45+
There is also now an advanced App that addresses the following issues:
46+
47+
1. Some resolutions are only available separated in two files, one for audio and one for video. We need to merge them after the download is completed.
48+
There is a great Java library for doing this with mp4 files: [mp4parser](https://github.com/sannies/mp4parser)
49+
50+
1. Some media players aren't able to read the dash container of the m4a Audio files. This is also fixable via the library mentioned above.
51+
52+
To try the app have a look at: [youtubeDownloader.apk](https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/bin/youtubeDownloader.apk)
53+
54+
<img src='https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/Screenshot_2015-04-26-17-04-382.png' width='250' alt='youtubeDownloader Screenshot 1'>
55+
56+
<img src='https://github.com/HaarigerHarald/android-youtubeExtractor/raw/master/Screenshot_2015-04-27-17-05-50.png' width='250' alt='youtubeDownloader Screenshot 2'>
4657

47-
48-

Screenshot_2015-02-10-15-12-45.png

-271 KB
Binary file not shown.

Screenshot_2015-02-11-19-29-13.png

-219 KB
Binary file not shown.

Screenshot_2015-04-26-17-04-382.png

350 KB
Loading

Screenshot_2015-04-27-17-05-50.png

310 KB
Loading
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="at.huber.youtubeDownloader"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-permission android:name="android.permission.INTERNET" />
8+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
10+
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
11+
12+
<uses-sdk
13+
android:minSdkVersion="11"
14+
android:targetSdkVersion="22" />
15+
16+
<application
17+
android:allowBackup="true"
18+
android:icon="@drawable/ic_launcher"
19+
android:label="@string/app_name">
20+
<activity
21+
android:name=".DownloadActivity"
22+
android:theme="@style/AppTheme"
23+
android:excludeFromRecents="true"
24+
android:taskAffinity="" >
25+
26+
<intent-filter>
27+
<action android:name="android.intent.action.SEND" />
28+
<category android:name="android.intent.category.DEFAULT" />
29+
<data android:mimeType="text/plain"/>
30+
</intent-filter>
31+
32+
</activity>
33+
34+
<receiver
35+
android:name="at.huber.youtubeDownloader.DownloadFinishedReceiver"
36+
android:exported="true" >
37+
<intent-filter>
38+
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
39+
</intent-filter>
40+
</receiver>
41+
</application>
42+
43+
</manifest>

advancedDownloader/NOTICE.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=========================================================================
2+
== NOTICE file corresponding to the section 4 d of ==
3+
== the Apache License, Version 2.0, ==
4+
== in this case for the Apache Maven distribution. ==
5+
=========================================================================
6+
7+
This product includes software developed by
8+
CoreMedia AG (http://www.coremedia.com/).
9+
10+
This product includes software developed by
11+
castLabs GmbH (http://www.castlabs.com/).
12+
13+
This product includes software developed by
14+
Sebastian Annies ([email protected])
15+
16+
This product includes software (Hex Encoder extracted from commons-codec) developed by
17+
The Apache Software Foundation (http://www.apache.org/).
18+
19+
This product includes software (package com.googlecode.mp4parser.h264) developed by
20+
Stanislav Vitvitskiy and originally licensed under MIT license (http://www.opensource.org/licenses/mit-license.php)
21+
22+
23+
24+
25+
26+
115 KB
Binary file not shown.
776 KB
Binary file not shown.
31.6 KB
Binary file not shown.

advancedDownloader/proguard.cfg

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This is a configuration file for ProGuard.
2+
# http://proguard.sourceforge.net/index.html#manual/usage.html
3+
4+
# Optimizations: If you don't want to optimize, use the
5+
# proguard-android.txt configuration file instead of this one, which
6+
# turns off the optimization flags. Adding optimization introduces
7+
# certain risks, since for example not all optimizations performed by
8+
# ProGuard works on all versions of Dalvik. The following flags turn
9+
# off various optimizations known to have issues, but the list may not
10+
# be complete or up to date. (The "arithmetic" optimization can be
11+
# used if you are only targeting Android 2.0 or later.) Make sure you
12+
# test thoroughly if you go this route.
13+
-dontoptimize
14+
-allowaccessmodification
15+
-dontpreverify
16+
-dontobfuscate
17+
18+
# The remainder of this file is identical to the non-optimized version
19+
# of the Proguard configuration file (except that the other file has
20+
# flags to turn off optimization).
21+
22+
-dontusemixedcaseclassnames
23+
-dontskipnonpubliclibraryclasses
24+
-verbose
25+
26+
-keepattributes *Annotation*
27+
-keep public class com.google.vending.licensing.ILicensingService
28+
-keep public class com.android.vending.licensing.ILicensingService
29+
-keep public class com.coremedia.iso.** { *; }
30+
-keep public class com.googlecode.mp4parser.** { *; }
31+
-keep public class org.aspectj.** { *; }
32+
-keep public class at.huber.youtubeExtractor.** { *; }
33+
-keep public class com.evgenii.jsevaluator.** { *; }
34+
-keep public interface com.evgenii.jsevaluator.** { *; }
35+
-keep public class com.evgenii.jsevaluator.interfaces.JavascriptCallback
36+
-keep public class * implements com.evgenii.jsevaluator.interfaces.JavascriptCallback
37+
-keepclassmembers class * implements com.evgenii.jsevaluator.interfaces.JavascriptCallback {
38+
<methods>;
39+
}
40+
41+
-assumenosideeffects class android.util.Log {
42+
public static boolean isLoggable(java.lang.String, int);
43+
public static int d(...);
44+
public static int v(...);
45+
public static int w(...);
46+
public static int i(...);
47+
}
48+
49+
# ADDED
50+
-keep class com.google.zxing.client.android.camera.open.**
51+
-keep class com.google.zxing.client.android.camera.exposure.**
52+
-keep class com.google.zxing.client.android.common.executor.**
53+
54+
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
55+
-keepclasseswithmembernames class * {
56+
native <methods>;
57+
}
58+
59+
# keep setters in Views so that animations can still work.
60+
# see http://proguard.sourceforge.net/manual/examples.html#beans
61+
-keepclassmembers public class * extends android.view.View {
62+
void set*(***);
63+
*** get*();
64+
}
65+
66+
# We want to keep methods in Activity that could be used in the XML attribute onClick
67+
-keepclassmembers class * extends android.app.Activity {
68+
public void *(android.view.View);
69+
}
70+
71+
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
72+
-keepclassmembers enum * {
73+
public static **[] values();
74+
public static ** valueOf(java.lang.String);
75+
}
76+
77+
-keep class * implements android.os.Parcelable {
78+
public static final android.os.Parcelable$Creator *;
79+
}
80+
81+
-keepclassmembers class **.R$* {
82+
public static <fields>;
83+
}
84+
85+
# The support library contains references to newer platform versions.
86+
# Don't warn about those in case this app is linking against an older
87+
# platform version. We know about them, and they are safe.
88+
-dontwarn android.support.**
89+
-dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg.**

advancedDownloader/project.properties

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-22
15+
proguard.config=proguard.cfg
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical"
6+
tools:context="at.huber.youtubeDownloader.DownloadActivity">
7+
8+
<TextView
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:layout_marginLeft="23dp"
12+
android:layout_marginRight="23dp"
13+
android:layout_marginTop="20dp"
14+
android:text="@string/app_name"
15+
android:textSize="20sp"
16+
android:textColor="@android:color/black"
17+
android:textAppearance="@android:style/TextAppearance.WindowTitle"/>
18+
19+
<ScrollView
20+
android:layout_width="match_parent"
21+
android:layout_height="match_parent"
22+
android:paddingBottom="16dp"
23+
android:paddingLeft="16dp"
24+
android:paddingRight="16dp"
25+
android:layout_marginTop="16dp"
26+
android:animateLayoutChanges="true" >
27+
28+
<LinearLayout
29+
android:id="@+id/main_layout"
30+
android:layout_width="match_parent"
31+
android:layout_height="wrap_content"
32+
android:orientation="vertical"
33+
android:gravity="center" >
34+
35+
<ProgressBar
36+
android:id="@+id/prgrBar"
37+
android:layout_width="wrap_content"
38+
android:layout_height="wrap_content"
39+
android:layout_gravity="center" />
40+
41+
</LinearLayout>
42+
43+
</ScrollView>
44+
</LinearLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<resources xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<style name="AppTheme" parent="@android:style/Theme.Material.Light.Dialog" >
4+
<item name="android:textAllCaps">false</item>
5+
<item name="android:windowNoTitle">true</item>
6+
<item name="android:windowMinWidthMinor">85%</item>
7+
<item name="android:windowMinWidthMajor">55%</item>
8+
</style>
9+
10+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">YouTube Download</string>
5+
<string name="error_no_yt_link">Not a valid YouTube link!</string>
6+
7+
</resources>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<resources xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.Dialog" >
4+
<item name="android:windowNoTitle">true</item>
5+
<item name="android:windowMinWidthMinor">85%</item>
6+
<item name="android:windowMinWidthMajor">55%</item>
7+
</style>
8+
9+
</resources>

0 commit comments

Comments
 (0)