url signature fix
* fixed stacktrace * changed player url * took regex fix from youtube-dl final fix taken from youtube-dl
This commit is contained in:
parent
77db2f8a48
commit
140b480f82
|
@ -125,10 +125,13 @@ public class StreamInfoWorker {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (YoutubeStreamExtractor.DecryptException de) {
|
} catch (YoutubeStreamExtractor.DecryptException de) {
|
||||||
// custom service related exceptions
|
// custom service related exceptions
|
||||||
|
ErrorActivity.reportError(h, a, de, VideoItemDetailFragment.class, null,
|
||||||
|
ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM,
|
||||||
|
service.getServiceInfo().name, videoUrl, R.string.youtube_signature_decryption_error));
|
||||||
h.post(new Runnable() {
|
h.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
onStreamInfoReceivedListener.onError(R.string.youtube_signature_decryption_error);
|
a.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
de.printStackTrace();
|
de.printStackTrace();
|
||||||
|
|
|
@ -42,15 +42,23 @@ public class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String matchGroup1(String pattern, String input) throws RegexException {
|
public static String matchGroup1(String pattern, String input) throws RegexException {
|
||||||
|
return matchGroup(pattern, input, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String matchGroup(String pattern, String input, int group) throws RegexException {
|
||||||
Pattern pat = Pattern.compile(pattern);
|
Pattern pat = Pattern.compile(pattern);
|
||||||
Matcher mat = pat.matcher(input);
|
Matcher mat = pat.matcher(input);
|
||||||
boolean foundMatch = mat.find();
|
boolean foundMatch = mat.find();
|
||||||
if (foundMatch) {
|
if (foundMatch) {
|
||||||
return mat.group(1);
|
return mat.group(group);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Log.e(TAG, "failed to find pattern \""+pattern+"\" inside of \""+input+"\"");
|
//Log.e(TAG, "failed to find pattern \""+pattern+"\" inside of \""+input+"\"");
|
||||||
throw new RegexException("failed to find pattern \""+pattern+" inside of "+input+"\"");
|
if(input.length() > 1024) {
|
||||||
|
throw new RegexException("failed to find pattern \""+pattern);
|
||||||
|
} else {
|
||||||
|
throw new RegexException("failed to find pattern \"" + pattern + " inside of " + input + "\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -791,10 +791,15 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Downloader downloader = NewPipe.getDownloader();
|
Downloader downloader = NewPipe.getDownloader();
|
||||||
|
if(!playerUrl.contains("https://youtube.com")) {
|
||||||
|
//sometimes the https://youtube.com part does not get send with
|
||||||
|
//than we have to add it by hand
|
||||||
|
playerUrl = "https://youtube.com" + playerUrl;
|
||||||
|
}
|
||||||
String playerCode = downloader.download(playerUrl);
|
String playerCode = downloader.download(playerUrl);
|
||||||
|
|
||||||
decryptionFuncName =
|
decryptionFuncName =
|
||||||
Parser.matchGroup1("\\.sig\\|\\|([a-zA-Z0-9$]+)\\(", playerCode);
|
Parser.matchGroup("([\"\\'])signature\\1\\s*,\\s*([a-zA-Z0-9$]+)\\(", playerCode, 2);
|
||||||
|
|
||||||
String functionPattern = "("
|
String functionPattern = "("
|
||||||
+ decryptionFuncName.replace("$", "\\$")
|
+ decryptionFuncName.replace("$", "\\$")
|
||||||
|
|
Loading…
Reference in New Issue