From e08256ebc6ac71f3d1b3d94db1f81359e3e69cb9 Mon Sep 17 00:00:00 2001
From: Fynn Godau Tracks don't have standalone ids, they are always in combination with the band id.
- * That's why id = url. Instead, URLs are cleaned up so that they always look the same.
Radio (bandcamp weekly) shows do have ids.
*/ @@ -33,10 +33,7 @@ public class BandcampStreamLinkHandlerFactory extends LinkHandlerFactory { public String getUrl(String input) { if (input.matches("\\d+")) return "https://bandcamp.com/?show=" + input; - if (input.endsWith("/")) - input = input.substring(0, input.length() - 1); - input = input.replace("http://", "https://").toLowerCase(); - return input; + else return input; } /** @@ -49,6 +46,6 @@ public class BandcampStreamLinkHandlerFactory extends LinkHandlerFactory { */ @Override public boolean onAcceptUrl(String url) { - return getUrl(url).matches("https?://.+\\..+/track/.+") || getUrl(url).matches("https?://bandcamp\\.com/\\?show=\\d+"); + return url.toLowerCase().matches("https?://.+\\..+/track/.+") || url.toLowerCase().matches("https?://bandcamp\\.com/\\?show=\\d+"); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampPlaylistLinkHandlerFactoryTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampPlaylistLinkHandlerFactoryTest.java index 1da3069c9..f9cf9b1a7 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampPlaylistLinkHandlerFactoryTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampPlaylistLinkHandlerFactoryTest.java @@ -40,6 +40,7 @@ public class BandcampPlaylistLinkHandlerFactoryTest { // Tests expecting true assertTrue(linkHandler.acceptUrl("https://powertothequeerkids.bandcamp.com/album/power-to-the-queer-kids")); assertTrue(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/album/prom")); + assertTrue(linkHandler.acceptUrl("https://MACBENSON.BANDCAMP.COM/ALBUM/COMING-OF-AGE")); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamLinkHandlerFactoryTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamLinkHandlerFactoryTest.java index 9cbd03295..3942fb1f1 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamLinkHandlerFactoryTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamLinkHandlerFactoryTest.java @@ -25,11 +25,6 @@ public class BandcampStreamLinkHandlerFactoryTest { NewPipe.init(DownloaderTestImpl.getInstance()); } - @Test - public void testUrlCleanup() { - assertEquals("https://zachbenson.bandcamp.com/track/u-i-tonite", linkHandler.getUrl("http://ZachBenson.Bandcamp.COM/Track/U-I-Tonite/")); - } - @Test public void testGetRadioUrl() { assertEquals("https://bandcamp.com/?show=1", linkHandler.getUrl("1"));