mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-22 16:10:31 +00:00
added check and exception reporting to YoutubeExtractor:matchGroup1, so that a failed match doesn't go unnoticed
This commit is contained in:
parent
59e512a64d
commit
fc32377ce7
@ -154,9 +154,8 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
JSONObject ytAssets = null;
|
JSONObject ytAssets = null;
|
||||||
String dashManifest;
|
String dashManifest;
|
||||||
{
|
{
|
||||||
String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site);
|
||||||
JSONObject jsonObj = new JSONObject(jsonString);
|
JSONObject jsonObj = new JSONObject(jsonString);
|
||||||
playerArgs = jsonObj.getJSONObject("args");
|
playerArgs = jsonObj.getJSONObject("args");
|
||||||
ytAssets = jsonObj.getJSONObject("assets");
|
ytAssets = jsonObj.getJSONObject("assets");
|
||||||
@ -461,7 +460,15 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
private String matchGroup1(String pattern, String input) {
|
private String matchGroup1(String pattern, String input) {
|
||||||
Pattern pat = Pattern.compile(pattern);
|
Pattern pat = Pattern.compile(pattern);
|
||||||
Matcher mat = pat.matcher(input);
|
Matcher mat = pat.matcher(input);
|
||||||
mat.find();
|
boolean foundMatch = mat.find();
|
||||||
return mat.group(1);
|
if(foundMatch){
|
||||||
|
return mat.group(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.e(TAG, "failed to find pattern \""+pattern+"\"");
|
||||||
|
new Exception("failed to find pattern \""+pattern+"\"").printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user