[Soundcloud] Fix checkstyle issues
This commit is contained in:
parent
9ab32cb2e7
commit
9dc17cd1ca
|
@ -44,7 +44,7 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SoundcloudParsingHelper {
|
||||
public final class SoundcloudParsingHelper {
|
||||
private static String clientId;
|
||||
public static final String SOUNDCLOUD_API_V2_URL = "https://api-v2.soundcloud.com/";
|
||||
|
||||
|
@ -52,7 +52,9 @@ public class SoundcloudParsingHelper {
|
|||
}
|
||||
|
||||
public static synchronized String clientId() throws ExtractionException, IOException {
|
||||
if (!isNullOrEmpty(clientId)) return clientId;
|
||||
if (!isNullOrEmpty(clientId)) {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
final Downloader dl = NewPipe.getDownloader();
|
||||
|
||||
|
@ -109,7 +111,7 @@ public class SoundcloudParsingHelper {
|
|||
public static JsonObject resolveFor(@Nonnull final Downloader downloader, final String url)
|
||||
throws IOException, ExtractionException {
|
||||
final String apiUrl = SOUNDCLOUD_API_V2_URL + "resolve"
|
||||
+ "?url=" + URLEncoder.encode(url, UTF_8)
|
||||
+ "?url=" + URLEncoder.encode(url, UTF_8)
|
||||
+ "&client_id=" + clientId();
|
||||
|
||||
try {
|
||||
|
@ -142,18 +144,20 @@ public class SoundcloudParsingHelper {
|
|||
*
|
||||
* @return the resolved id
|
||||
*/
|
||||
public static String resolveIdWithWidgetApi(String urlString) throws IOException,
|
||||
public static String resolveIdWithWidgetApi(final String urlString) throws IOException,
|
||||
ParsingException {
|
||||
// Remove the tailing slash from URLs due to issues with the SoundCloud API
|
||||
if (urlString.charAt(urlString.length() - 1) == '/') urlString = urlString.substring(0,
|
||||
urlString.length() - 1);
|
||||
String fixedUrl = urlString;
|
||||
if (fixedUrl.charAt(fixedUrl.length() - 1) == '/') {
|
||||
fixedUrl = fixedUrl.substring(0, fixedUrl.length() - 1);
|
||||
}
|
||||
// Make URL lower case and remove m. and www. if it exists.
|
||||
// Without doing this, the widget API does not recognize the URL.
|
||||
urlString = Utils.removeMAndWWWFromUrl(urlString.toLowerCase());
|
||||
fixedUrl = Utils.removeMAndWWWFromUrl(fixedUrl.toLowerCase());
|
||||
|
||||
final URL url;
|
||||
try {
|
||||
url = Utils.stringToURL(urlString);
|
||||
url = Utils.stringToURL(fixedUrl);
|
||||
} catch (final MalformedURLException e) {
|
||||
throw new IllegalArgumentException("The given URL is not valid");
|
||||
}
|
||||
|
@ -225,8 +229,9 @@ public class SoundcloudParsingHelper {
|
|||
String nextPageUrl;
|
||||
try {
|
||||
nextPageUrl = responseObject.getString("next_href");
|
||||
if (!nextPageUrl.contains("client_id=")) nextPageUrl += "&client_id="
|
||||
+ SoundcloudParsingHelper.clientId();
|
||||
if (!nextPageUrl.contains("client_id=")) {
|
||||
nextPageUrl += "&client_id=" + SoundcloudParsingHelper.clientId();
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
nextPageUrl = "";
|
||||
}
|
||||
|
@ -291,8 +296,9 @@ public class SoundcloudParsingHelper {
|
|||
String nextPageUrl;
|
||||
try {
|
||||
nextPageUrl = responseObject.getString("next_href");
|
||||
if (!nextPageUrl.contains("client_id=")) nextPageUrl += "&client_id="
|
||||
+ SoundcloudParsingHelper.clientId();
|
||||
if (!nextPageUrl.contains("client_id=")) {
|
||||
nextPageUrl += "&client_id=" + SoundcloudParsingHelper.clientId();
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
nextPageUrl = "";
|
||||
}
|
||||
|
|
|
@ -1,25 +1,42 @@
|
|||
package org.schabi.newpipe.extractor.services.soundcloud;
|
||||
|
||||
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
|
||||
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
||||
import org.schabi.newpipe.extractor.comments.CommentsExtractor;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.kiosk.KioskList;
|
||||
import org.schabi.newpipe.extractor.linkhandler.*;
|
||||
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
|
||||
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
|
||||
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.localization.ContentCountry;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.*;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.*;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChartsExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudCommentsExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudPlaylistExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudStreamExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudSubscriptionExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudSuggestionExtractor;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudChannelLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudChartsLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudCommentsLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudPlaylistLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudSearchQueryHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudStreamLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
|
||||
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
|
||||
|
||||
public class SoundcloudService extends StreamingService {
|
||||
|
||||
public SoundcloudService(final int id) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsing
|
|||
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public class SoundcloudChannelExtractor extends ChannelExtractor {
|
||||
private String userId;
|
||||
private JsonObject user;
|
||||
|
|
|
@ -25,9 +25,8 @@ public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtrac
|
|||
|
||||
@Override
|
||||
public String getThumbnailUrl() {
|
||||
String avatarUrl = itemObject.getString("avatar_url", EMPTY_STRING);
|
||||
// An avatar URL with a better resolution
|
||||
return avatarUrl.replace("large.jpg", "crop.jpg");
|
||||
return itemObject.getString("avatar_url", EMPTY_STRING).replace("large.jpg", "crop.jpg");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SoundcloudPlaylistInfoItemExtractor implements PlaylistInfoItemExtr
|
|||
|
||||
// First look for track artwork url
|
||||
if (trackObject.isString(ARTWORK_URL_KEY)) {
|
||||
String artworkUrl = trackObject.getString(ARTWORK_URL_KEY, EMPTY_STRING);
|
||||
final String artworkUrl = trackObject.getString(ARTWORK_URL_KEY, EMPTY_STRING);
|
||||
if (!artworkUrl.isEmpty()) {
|
||||
// An artwork URL with a better resolution
|
||||
return artworkUrl.replace("large.jpg", "crop.jpg");
|
||||
|
@ -56,7 +56,9 @@ public class SoundcloudPlaylistInfoItemExtractor implements PlaylistInfoItemExtr
|
|||
// Then look for track creator avatar url
|
||||
final JsonObject creator = trackObject.getObject(USER_KEY);
|
||||
final String creatorAvatar = creator.getString(AVATAR_URL_KEY, EMPTY_STRING);
|
||||
if (!creatorAvatar.isEmpty()) return creatorAvatar;
|
||||
if (!creatorAvatar.isEmpty()) {
|
||||
return creatorAvatar;
|
||||
}
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
// Try other method
|
||||
|
|
|
@ -4,7 +4,13 @@ import com.grack.nanojson.JsonArray;
|
|||
import com.grack.nanojson.JsonObject;
|
||||
import com.grack.nanojson.JsonParser;
|
||||
import com.grack.nanojson.JsonParserException;
|
||||
import org.schabi.newpipe.extractor.*;
|
||||
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.InfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.InfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.MetaInfo;
|
||||
import org.schabi.newpipe.extractor.Page;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.downloader.Downloader;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
|
@ -76,9 +82,9 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
|
|||
throw new ParsingException("Could not parse json response", e);
|
||||
}
|
||||
|
||||
return new InfoItemsPage<>(
|
||||
collectItems(searchCollection),
|
||||
getNextPageFromCurrentUrl(page.getUrl(), currentOffset -> currentOffset + ITEMS_PER_PAGE));
|
||||
return new InfoItemsPage<>(collectItems(searchCollection),
|
||||
getNextPageFromCurrentUrl(page.getUrl(),
|
||||
currentOffset -> currentOffset + ITEMS_PER_PAGE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +109,10 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
|
|||
final MultiInfoItemsCollector collector = new MultiInfoItemsCollector(getServiceId());
|
||||
|
||||
for (final Object result : searchCollection) {
|
||||
if (!(result instanceof JsonObject)) continue;
|
||||
if (!(result instanceof JsonObject)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final JsonObject searchResult = (JsonObject) result;
|
||||
final String kind = searchResult.getString("kind", EMPTY_STRING);
|
||||
switch (kind) {
|
||||
|
@ -122,7 +131,8 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
|
|||
return collector;
|
||||
}
|
||||
|
||||
private Page getNextPageFromCurrentUrl(final String currentUrl, final IntUnaryOperator newPageOffsetCalculator)
|
||||
private Page getNextPageFromCurrentUrl(final String currentUrl,
|
||||
final IntUnaryOperator newPageOffsetCalculator)
|
||||
throws MalformedURLException, UnsupportedEncodingException {
|
||||
final int currentPageOffset = Integer.parseInt(
|
||||
Parser.compatParseMap(new URL(currentUrl).getQuery()).get("offset"));
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package org.schabi.newpipe.extractor.services.soundcloud.extractors;
|
||||
|
||||
import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper.SOUNDCLOUD_API_V2_URL;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.HTTPS;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||
|
||||
import com.grack.nanojson.JsonArray;
|
||||
import com.grack.nanojson.JsonObject;
|
||||
import com.grack.nanojson.JsonParser;
|
||||
import com.grack.nanojson.JsonParserException;
|
||||
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
import org.schabi.newpipe.extractor.MetaInfo;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.downloader.Downloader;
|
||||
|
@ -18,20 +24,22 @@ import org.schabi.newpipe.extractor.exceptions.SoundCloudGoPlusContentException;
|
|||
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
|
||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
||||
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper;
|
||||
import org.schabi.newpipe.extractor.stream.*;
|
||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||
import org.schabi.newpipe.extractor.stream.Description;
|
||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper.SOUNDCLOUD_API_V2_URL;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.*;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
private JsonObject track;
|
||||
|
@ -53,8 +61,10 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
if (policy.equals("SNIP")) {
|
||||
throw new SoundCloudGoPlusContentException();
|
||||
}
|
||||
if (policy.equals("BLOCK")) throw new GeographicRestrictionException(
|
||||
if (policy.equals("BLOCK")) {
|
||||
throw new GeographicRestrictionException(
|
||||
"This track is not available in user's country");
|
||||
}
|
||||
throw new ContentNotAvailableException("Content not available: policy " + policy);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +162,9 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
// Streams can be streamable and downloadable - or explicitly not.
|
||||
// For playing the track, it is only necessary to have a streamable track.
|
||||
// If this is not the case, this track might not be published yet.
|
||||
if (!track.getBoolean("streamable") || !isAvailable) return audioStreams;
|
||||
if (!track.getBoolean("streamable") || !isAvailable) {
|
||||
return audioStreams;
|
||||
}
|
||||
|
||||
try {
|
||||
final JsonArray transcodings = track.getObject("media").getArray("transcodings");
|
||||
|
@ -172,8 +184,8 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
boolean presence = false;
|
||||
for (final Object transcoding : transcodings) {
|
||||
final JsonObject transcodingJsonObject = (JsonObject) transcoding;
|
||||
if (transcodingJsonObject.getString("preset").contains("mp3") &&
|
||||
transcodingJsonObject.getObject("format").getString("protocol")
|
||||
if (transcodingJsonObject.getString("preset").contains("mp3")
|
||||
&& transcodingJsonObject.getObject("format").getString("protocol")
|
||||
.equals("progressive")) {
|
||||
presence = true;
|
||||
break;
|
||||
|
@ -345,10 +357,9 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
final List<String> tags = new ArrayList<>();
|
||||
String escapedTag = "";
|
||||
boolean isEscaped = false;
|
||||
for (int i = 0; i < tagList.length; i++) {
|
||||
String tag = tagList[i];
|
||||
for (final String tag : tagList) {
|
||||
if (tag.startsWith("\"")) {
|
||||
escapedTag += tagList[i].replace("\"", "");
|
||||
escapedTag += tag.replace("\"", "");
|
||||
isEscaped = true;
|
||||
} else if (isEscaped) {
|
||||
if (tag.endsWith("\"")) {
|
||||
|
@ -358,7 +369,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
} else {
|
||||
escapedTag += " " + tag;
|
||||
}
|
||||
} else if (!tag.isEmpty()){
|
||||
} else if (!tag.isEmpty()) {
|
||||
tags.add(tag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ public class SoundcloudSubscriptionExtractor extends SubscriptionExtractor {
|
|||
@Override
|
||||
public List<SubscriptionItem> fromChannelUrl(final String channelUrl) throws IOException,
|
||||
ExtractionException {
|
||||
if (channelUrl == null) throw new InvalidSourceException("Channel url is null");
|
||||
if (channelUrl == null) {
|
||||
throw new InvalidSourceException("Channel url is null");
|
||||
}
|
||||
|
||||
final String id;
|
||||
try {
|
||||
|
@ -53,18 +55,15 @@ public class SoundcloudSubscriptionExtractor extends SubscriptionExtractor {
|
|||
return toSubscriptionItems(collector.getItems());
|
||||
}
|
||||
|
||||
private String getUrlFrom(String channelUrl) {
|
||||
channelUrl = replaceHttpWithHttps(channelUrl);
|
||||
|
||||
if (!channelUrl.startsWith(HTTPS)) {
|
||||
if (!channelUrl.contains("soundcloud.com/")) {
|
||||
channelUrl = "https://soundcloud.com/" + channelUrl;
|
||||
} else {
|
||||
channelUrl = HTTPS + channelUrl;
|
||||
}
|
||||
private String getUrlFrom(final String channelUrl) {
|
||||
final String fixedUrl = replaceHttpWithHttps(channelUrl);
|
||||
if (fixedUrl.startsWith(HTTPS)) {
|
||||
return channelUrl;
|
||||
} else if (!fixedUrl.contains("soundcloud.com/")) {
|
||||
return "https://soundcloud.com/" + fixedUrl;
|
||||
} else {
|
||||
return HTTPS + fixedUrl;
|
||||
}
|
||||
|
||||
return channelUrl;
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -39,8 +39,9 @@ public class SoundcloudSuggestionExtractor extends SuggestionExtractor {
|
|||
try {
|
||||
final JsonArray collection = JsonParser.object().from(response).getArray("collection");
|
||||
for (final Object suggestion : collection) {
|
||||
if (suggestion instanceof JsonObject) suggestions.add(((JsonObject) suggestion)
|
||||
.getString("query"));
|
||||
if (suggestion instanceof JsonObject) {
|
||||
suggestions.add(((JsonObject) suggestion).getString("query"));
|
||||
}
|
||||
}
|
||||
|
||||
return suggestions;
|
||||
|
|
|
@ -8,14 +8,17 @@ import org.schabi.newpipe.extractor.utils.Utils;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SoundcloudChannelLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
private static final SoundcloudChannelLinkHandlerFactory instance =
|
||||
new SoundcloudChannelLinkHandlerFactory();
|
||||
private static final String URL_PATTERN ="^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+"
|
||||
public final class SoundcloudChannelLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
private static final SoundcloudChannelLinkHandlerFactory INSTANCE
|
||||
= new SoundcloudChannelLinkHandlerFactory();
|
||||
private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+"
|
||||
+ "(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$";
|
||||
|
||||
private SoundcloudChannelLinkHandlerFactory() {
|
||||
}
|
||||
|
||||
public static SoundcloudChannelLinkHandlerFactory getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,13 +9,16 @@ import java.util.List;
|
|||
|
||||
import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper.clientId;
|
||||
|
||||
public class SoundcloudCommentsLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
public final class SoundcloudCommentsLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
|
||||
private static final SoundcloudCommentsLinkHandlerFactory instance =
|
||||
private static final SoundcloudCommentsLinkHandlerFactory INSTANCE =
|
||||
new SoundcloudCommentsLinkHandlerFactory();
|
||||
|
||||
private SoundcloudCommentsLinkHandlerFactory() {
|
||||
}
|
||||
|
||||
public static SoundcloudCommentsLinkHandlerFactory getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,14 +8,17 @@ import org.schabi.newpipe.extractor.utils.Utils;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
private static final SoundcloudPlaylistLinkHandlerFactory instance =
|
||||
public final class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||
private static final SoundcloudPlaylistLinkHandlerFactory INSTANCE =
|
||||
new SoundcloudPlaylistLinkHandlerFactory();
|
||||
private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+"
|
||||
+ "/sets/[0-9a-z_-]+/?([#?].*)?$";
|
||||
|
||||
private SoundcloudPlaylistLinkHandlerFactory() {
|
||||
}
|
||||
|
||||
public static SoundcloudPlaylistLinkHandlerFactory getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,9 +6,9 @@ import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper;
|
|||
import org.schabi.newpipe.extractor.utils.Parser;
|
||||
import org.schabi.newpipe.extractor.utils.Utils;
|
||||
|
||||
public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||
private static final SoundcloudStreamLinkHandlerFactory instance =
|
||||
new SoundcloudStreamLinkHandlerFactory();
|
||||
public final class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||
private static final SoundcloudStreamLinkHandlerFactory INSTANCE
|
||||
= new SoundcloudStreamLinkHandlerFactory();
|
||||
private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+"
|
||||
+ "/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$";
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
|
|||
}
|
||||
|
||||
public static SoundcloudStreamLinkHandlerFactory getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue