mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2024-12-12 11:59:45 +01:00
commit
0061131d39
@ -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() {
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user