From 5decd555510a7ef55e40c0287fd2990d082f0aba Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 26 Feb 2016 01:42:38 +0100 Subject: [PATCH] fixed another pattern problem --- .../services/youtube/YoutubeVideoUrlIdHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeVideoUrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeVideoUrlIdHandler.java index c74924cc1..23a294741 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeVideoUrlIdHandler.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeVideoUrlIdHandler.java @@ -53,7 +53,11 @@ public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler { } } else if(url.contains("youtu.be")) { - id = Parser.matchGroup1("youtu\\.be/([a-zA-Z0-9_-]{11})", url); + 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); + } } else { throw new ParsingException("Error no suitable url: " + url); @@ -61,7 +65,6 @@ public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler { if(!id.isEmpty()){ - //Log.i(TAG, "string \""+url+"\" matches!"); return id; } else { throw new ParsingException("Error could not parse url: " + url);