Remove "url cleanup" in Bandcamp link handlers
This commit is contained in:
parent
692b2d06f4
commit
e08256ebc6
|
@ -18,14 +18,11 @@ public class BandcampPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
|
|||
|
||||
@Override
|
||||
public String getUrl(String url, List<String> contentFilter, String sortFilter) throws ParsingException {
|
||||
if (url.endsWith("/"))
|
||||
url = url.substring(0, url.length() - 1);
|
||||
url = url.replace("http://", "https://").toLowerCase();
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onAcceptUrl(String url) throws ParsingException {
|
||||
return getUrl(url).matches("https?://.+\\..+/album/.+");
|
||||
public boolean onAcceptUrl(String url) {
|
||||
return url.toLowerCase().matches("https?://.+\\..+/album/.+");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
|
|||
|
||||
/**
|
||||
* <p>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.</p>
|
||||
* That's why id = url.</p>
|
||||
*
|
||||
* <p>Radio (bandcamp weekly) shows do have ids.</p>
|
||||
*/
|
||||
|
@ -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+");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue