Comments (21)
Okay. Thank you
from youp3.
Ok, I'm nearly done cleaning it up! I'll have some bug search now, and will try to understand if I need any feature to push to it.
I'll update codes in this week after my laptop arrives.
from youp3.
from youp3.
Awesome! Is there anyway you can publish it today?
from youp3.
from youp3.
Okay. If you need a tester or something, just let me know.
from youp3.
from youp3.
Is there anyway you can email me the new and changed files as I need them for a project?
from youp3.
from youp3.
Okay
from youp3.
Actually, most codes are ready. But, I'm facing heavy attacks from Google side while I'm trying to manage those downloads while targeting API 26+. Else, it would be the previous day I've already released the latest version.
By the way, code for which work do you want > I need them for a project?
If I have , I'll provide it here.
from youp3.
I actually need all of the code so it can pull the song data from the YouTube video instead of displaying “YouTube” for the song name.
from youp3.
Well, I need more time than expected. So I'm giving you some example for a quick reference. Actually, my engineering college admission is currently running, so I'm quite busy.
package utils;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Log;
import android.util.Patterns;
import android.util.SparseArray;
import android.webkit.CookieManager;
import android.webkit.MimeTypeMap;
import android.webkit.ValueCallback;
import android.webkit.WebStorage;
import android.webkit.WebView;
import com.koushikdutta.ion.Ion;
import org.apache.commons.io.FilenameUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.regex.Pattern;
/*
* Created by exploitr on 01-10-2017.
*/
public class Helper {
private static final String API_KEY = "AI***********************************oM"; //certificate restricted key
public static String getTitle(Context context, String url) {
verb(url);
String finalUrl = getQueryString(url);
verb(finalUrl);
String jsonContent = getJsonContent(context, finalUrl);
verb(jsonContent);
try {
JSONObject jsonObject = new JSONObject(jsonContent);
JSONArray jsonArray = jsonObject.getJSONArray("items");
JSONObject object = jsonArray.getJSONObject(0);
JSONObject snippet = object.getJSONObject("snippet");
String title = snippet.getString("title");
verb(title);
return title;
} catch (JSONException e) {
e.printStackTrace();
return "error";
}
}
/**
* @param blockedString Pass string with chars not allowed in a filename
* @return fresh-And-Sweet String
*/
public static String getFilenameFromString(String blockedString) {
return blockedString.replaceAll("[\\\\/:*?\"<>|]", "")
.replaceAll("[^a-zA-Z0-9.-]", " ")
.replaceAll("^ +| +$|( )+", "$1")
.replace("\"", ""); //REGEX;
}
private static String getQueryString(String videoUrl) {
// "https://www.youtube.com/oembed?url=" + url + "&format=json";
String[] cow = videoUrl.split("v="); //https://www.youtube.com/watch? | SnnJg0jqr8A
if (videoUrl.contains("&")) { //https://www.youtube.com/watch?v= | SnnJg0jqr8A&app=desktop
cow = cow[1].split("&"); //SnnJg0jqr8A | app=desktop
videoUrl = cow[0];//SnnJg0jqr8A
verb(videoUrl);
} else {
videoUrl = cow[1];//SnnJg0jqr8A
verb(videoUrl);
}
return "https://www.googleapis.com/youtube/v3/videos?id=" + videoUrl + "&key=" +
API_KEY +
"&part=snippet";
}
private static String getJsonContent(Context context, String finalUrl) {
try {
String packageName = context.getPackageName();
String SHA1 = getSHA1(context);
return Ion.with(context)
.load(finalUrl)
.setHeader("X-Android-Package", packageName)
.setHeader("X-Android-Cert", SHA1)
.asString()
.get();
} catch (InterruptedException | ExecutionException e) {
return "error";
}
}
private static String encode(byte[] byteArray) {
char[] HEX = new char[]{
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
StringBuilder hexBuffer = new StringBuilder(byteArray.length * 2);
for (byte aByteArray : byteArray)
for (int j = 1; j >= 0; j--)
hexBuffer.append(HEX[(aByteArray >> (j * 4)) & 0xF]);
return hexBuffer.toString();
}
@SuppressLint("PackageManagerGetSignatures") //minTargetApi 19
private static String getSHA1(Context context) {
try {
Signature[] signatures = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures;
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
for (Signature signature : signatures) {
md.update(signature.toByteArray());
}
return encode(md.digest());
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
}
from youp3.
The code also contain procedures to validate your apk-signing your certificate's SHA1 with the one you will store at Google Dev Console.
https://console.developers.google.com/projectselector/apis/credentials?supportedpurview=project
from youp3.
It's my pleasure. I'll update the whole code when I get out of this war of admission.
from youp3.
estimated time?
from youp3.
can you just email me the code?
from youp3.
That would be fine! so the address (don't hardcode using @ )?
Actually having problems uploading to GitHub, don't have much time now.
from youp3.
boothby (at) graphfixmedia.com thanks!
from youp3.
you can just send me the whole project file 🙂
from youp3.
check your mailbox
from youp3.
Related Issues (11)
- YouP3 v1.4.0; Content is downloaded with my device's stock downloader app, not that of Youp3. HOT 2
- YouTube download HOT 1
- could not find Com.gu: option :1.3. HOT 1
- The download is not getting started
- How to get all download option at least upto 1080p
- App not closing from exit popup. HOT 3
- App does not exit from navigation bar.
- [ Bug found in Youp3 version (1.3.0) ] the application is crash when i try to download any video HOT 10
- Youp3 v1.0.3: The app crashes every time I try to launch it. HOT 5
- Can't download a video from youtube into mp3 format. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youp3.