From 6a70cb9d50132c1cf1bf59478f029b199d65fefc Mon Sep 17 00:00:00 2001 From: Scratch Date: Fri, 16 Oct 2020 13:39:58 +1100 Subject: [PATCH] Remove tailing slash from SoundCloud URLs Fixes #412 --- .../soundcloud/extractors/SoundcloudStreamExtractor.java | 2 +- .../linkHandler/SoundcloudStreamLinkHandlerFactory.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java index 6aee297d..d909acfc 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java @@ -46,7 +46,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor { @Override public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException { - track = SoundcloudParsingHelper.resolveFor(downloader, getOriginalUrl()); + track = SoundcloudParsingHelper.resolveFor(downloader, getUrl()); String policy = track.getString("policy", EMPTY_STRING); if (!policy.equals("ALLOW") && !policy.equals("MONETIZE")) { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudStreamLinkHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudStreamLinkHandlerFactory.java index e271345d..c70eff01 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudStreamLinkHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudStreamLinkHandlerFactory.java @@ -30,6 +30,8 @@ public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory { @Override public String getId(String url) throws ParsingException { Utils.checkUrl(URL_PATTERN, url); + // Remove the tailing slash from URLs due to issues with the SoundCloud API + if (url.charAt(url.length() -1) == '/') url = url.substring(0, url.length()-1); try { return SoundcloudParsingHelper.resolveIdWithEmbedPlayer(url);