From 319d769233f8c3ba55edf38c77f7b659f7d0bf6f Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sat, 25 Feb 2017 18:14:32 -0300 Subject: [PATCH 1/3] Change video Id The previous wasn't working --- .../youtube/youtube/YoutubeStreamUrlIdHandlerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/test/java/org/schabi/newpipe/extractor/services/youtube/youtube/YoutubeStreamUrlIdHandlerTest.java b/app/src/test/java/org/schabi/newpipe/extractor/services/youtube/youtube/YoutubeStreamUrlIdHandlerTest.java index 79bb5d88e..67746ade3 100644 --- a/app/src/test/java/org/schabi/newpipe/extractor/services/youtube/youtube/YoutubeStreamUrlIdHandlerTest.java +++ b/app/src/test/java/org/schabi/newpipe/extractor/services/youtube/youtube/YoutubeStreamUrlIdHandlerTest.java @@ -111,9 +111,9 @@ public class YoutubeStreamUrlIdHandlerTest { assertTrue(urlIdHandler.acceptUrl("vnd.youtube:jZViOEv90dI")); - String sharedId = "7JIArTByb3E"; + String sharedId = "8A940MXKFmQ"; assertTrue(urlIdHandler.acceptUrl("vnd.youtube://www.youtube.com/shared?ci=" + sharedId + "&feature=twitter-deep-link")); assertTrue(urlIdHandler.acceptUrl("vnd.youtube://www.youtube.com/shared?ci=" + sharedId )); - assertTrue(urlIdHandler.acceptUrl("https://www.youtube.com/shared?ci=7JIArTByb3E")); + assertTrue(urlIdHandler.acceptUrl("https://www.youtube.com/shared?ci=" + sharedId)); } } \ No newline at end of file From 07f6d0f14975aa7c0e5eddf441337754f80ef824 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sat, 25 Feb 2017 18:15:50 -0300 Subject: [PATCH 2/3] Fix bug lower case id This method was passing the lowercase url --- .../services/youtube/YoutubeStreamUrlIdHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java index 355da0402..0d52612da 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java @@ -15,7 +15,6 @@ import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLDecoder; -import java.util.regex.Matcher; /** * Created by Christian Schabesberger on 02.02.16. @@ -149,12 +148,14 @@ public class YoutubeStreamUrlIdHandler implements UrlIdHandler { @Override public boolean acceptUrl(String videoUrl) { + String originalUrl = videoUrl; + videoUrl = videoUrl.toLowerCase(); if(videoUrl.contains("youtube") || videoUrl.contains("youtu.be")) { // bad programming I know try { - getId(videoUrl); + getId(originalUrl); return true; } catch (Exception e) { return false; From 2ccae841d6611f3975a8f1ede44466560870518b Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sun, 26 Feb 2017 07:47:13 -0300 Subject: [PATCH 3/3] Change variable names For a better understanding of what is going on --- .../services/youtube/YoutubeStreamUrlIdHandler.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java index 0d52612da..055cd5970 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java @@ -148,14 +148,12 @@ public class YoutubeStreamUrlIdHandler implements UrlIdHandler { @Override public boolean acceptUrl(String videoUrl) { - String originalUrl = videoUrl; - - videoUrl = videoUrl.toLowerCase(); - if(videoUrl.contains("youtube") || - videoUrl.contains("youtu.be")) { + String lowercaseUrl = videoUrl.toLowerCase(); + if(lowercaseUrl.contains("youtube") || + lowercaseUrl.contains("youtu.be")) { // bad programming I know try { - getId(originalUrl); + getId(videoUrl); return true; } catch (Exception e) { return false;