fixed another pattern problem

This commit is contained in:
Christian Schabesberger 2016-02-26 01:42:38 +01:00
parent 11d3aeb0dd
commit 5decd55551

View file

@ -53,15 +53,18 @@ public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler {
} }
} }
else if(url.contains("youtu.be")) { else if(url.contains("youtu.be")) {
if(url.contains("v=")) {
id = Parser.matchGroup1("v=([\\-a-zA-Z0-9_]{11})", url);
} else {
id = Parser.matchGroup1("youtu\\.be/([a-zA-Z0-9_-]{11})", url); id = Parser.matchGroup1("youtu\\.be/([a-zA-Z0-9_-]{11})", url);
} }
}
else { else {
throw new ParsingException("Error no suitable url: " + url); throw new ParsingException("Error no suitable url: " + url);
} }
if(!id.isEmpty()){ if(!id.isEmpty()){
//Log.i(TAG, "string \""+url+"\" matches!");
return id; return id;
} else { } else {
throw new ParsingException("Error could not parse url: " + url); throw new ParsingException("Error could not parse url: " + url);