diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java index 985b7dc46..c0f926933 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java @@ -9,9 +9,8 @@ import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; public class SoundcloudChannelUrlIdHandler implements UrlIdHandler { - private static final SoundcloudChannelUrlIdHandler instance = new SoundcloudChannelUrlIdHandler(); - private final String URL_PATTERN = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+" + + private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$"; public static SoundcloudChannelUrlIdHandler getInstance() { diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java index 642e89c84..b26f0deb0 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java @@ -4,6 +4,9 @@ import org.schabi.newpipe.extractor.UrlIdHandler; import org.schabi.newpipe.extractor.utils.Parser; public class SoundcloudChartsUrlIdHandler implements UrlIdHandler { + private final String TOP_URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$"; + private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$"; + public String getUrl(String id) { if (id.equals("Top 50")) { return "https://soundcloud.com/charts/top"; @@ -14,7 +17,7 @@ public class SoundcloudChartsUrlIdHandler implements UrlIdHandler { @Override public String getId(String url) { - if (Parser.isMatch("^https?://(www\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$", url.toLowerCase())) { + if (Parser.isMatch(TOP_URL_PATTERN, url.toLowerCase())) { return "Top 50"; } else { return "New & hot"; @@ -23,7 +26,7 @@ public class SoundcloudChartsUrlIdHandler implements UrlIdHandler { @Override public String cleanUrl(String url) { - if (Parser.isMatch("^https?://(www\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$", url.toLowerCase())) { + if (Parser.isMatch(TOP_URL_PATTERN, url.toLowerCase())) { return "https://soundcloud.com/charts/top"; } else { return "https://soundcloud.com/charts/new"; @@ -32,6 +35,6 @@ public class SoundcloudChartsUrlIdHandler implements UrlIdHandler { @Override public boolean acceptUrl(String url) { - return Parser.isMatch("^https?://(www\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$", url.toLowerCase()); + return Parser.isMatch(URL_PATTERN, url.toLowerCase()); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java index 7260f19d9..ea883c43a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java @@ -9,9 +9,8 @@ import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; public class SoundcloudPlaylistUrlIdHandler implements UrlIdHandler { - private static final SoundcloudPlaylistUrlIdHandler instance = new SoundcloudPlaylistUrlIdHandler(); - private final String URL_PATTERN = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+" + + private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "/sets/[0-9a-z_-]+/?([#?].*)?$"; public static SoundcloudPlaylistUrlIdHandler getInstance() { diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java index 1adbf4623..2857c1baa 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java @@ -9,9 +9,8 @@ import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; public class SoundcloudStreamUrlIdHandler implements UrlIdHandler { - private static final SoundcloudStreamUrlIdHandler instance = new SoundcloudStreamUrlIdHandler(); - private final String URL_PATTERN = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+" + + private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$"; private SoundcloudStreamUrlIdHandler() {