2017-08-04 16:21:45 +02:00
|
|
|
package org.schabi.newpipe.extractor.services.soundcloud;
|
|
|
|
|
2022-03-18 11:12:45 +01:00
|
|
|
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;
|
|
|
|
|
2019-02-15 20:27:00 +01:00
|
|
|
import org.schabi.newpipe.extractor.StreamingService;
|
2017-08-11 03:23:09 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
2023-06-29 22:56:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
|
2018-08-20 00:52:19 +02:00
|
|
|
import org.schabi.newpipe.extractor.comments.CommentsExtractor;
|
2017-08-04 16:21:45 +02:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
2017-08-12 17:29:28 +02:00
|
|
|
import org.schabi.newpipe.extractor.kiosk.KioskList;
|
2022-03-18 11:12:45 +01:00
|
|
|
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;
|
2020-03-29 11:13:39 +02:00
|
|
|
import org.schabi.newpipe.extractor.localization.ContentCountry;
|
2017-08-04 16:21:45 +02:00
|
|
|
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
2018-05-13 21:28:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
2022-03-18 11:12:45 +01:00
|
|
|
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelExtractor;
|
2023-06-29 22:56:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelTabExtractor;
|
2022-03-18 11:12:45 +01:00
|
|
|
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;
|
2023-06-29 22:56:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.soundcloud.linkHandler.SoundcloudChannelTabLinkHandlerFactory;
|
2022-03-18 11:12:45 +01:00
|
|
|
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;
|
2017-08-04 16:21:45 +02:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
2018-02-22 15:52:38 +01:00
|
|
|
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
2017-08-04 16:21:45 +02:00
|
|
|
|
2020-03-29 11:13:39 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
public class SoundcloudService extends StreamingService {
|
|
|
|
|
2021-05-15 17:51:43 +02:00
|
|
|
public SoundcloudService(final int id) {
|
2020-04-10 14:48:11 +02:00
|
|
|
super(id, "SoundCloud", asList(AUDIO, COMMENTS));
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
2020-02-08 23:58:46 +01:00
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
@Override
|
2019-11-19 22:38:17 +01:00
|
|
|
public String getBaseUrl() {
|
|
|
|
return "https://soundcloud.com";
|
2018-05-13 21:28:51 +02:00
|
|
|
}
|
|
|
|
|
2018-05-26 19:15:45 +02:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public SearchQueryHandlerFactory getSearchQHFactory() {
|
2023-06-29 22:56:51 +02:00
|
|
|
return SoundcloudSearchQueryHandlerFactory.getInstance();
|
2018-05-26 19:15:45 +02:00
|
|
|
}
|
2018-05-13 21:28:51 +02:00
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public LinkHandlerFactory getStreamLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return SoundcloudStreamLinkHandlerFactory.getInstance();
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public ListLinkHandlerFactory getChannelLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return SoundcloudChannelLinkHandlerFactory.getInstance();
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
|
|
|
|
2023-06-29 22:56:51 +02:00
|
|
|
@Override
|
|
|
|
public ListLinkHandlerFactory getChannelTabLHFactory() {
|
|
|
|
return SoundcloudChannelTabLinkHandlerFactory.getInstance();
|
|
|
|
}
|
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public ListLinkHandlerFactory getPlaylistLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return SoundcloudPlaylistLinkHandlerFactory.getInstance();
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
|
|
|
|
2020-03-29 11:13:39 +02:00
|
|
|
@Override
|
|
|
|
public List<ContentCountry> getSupportedCountries() {
|
2021-05-15 17:51:43 +02:00
|
|
|
// Country selector here: https://soundcloud.com/charts/top?genre=all-music
|
2020-03-29 11:13:39 +02:00
|
|
|
return ContentCountry.listFrom(
|
|
|
|
"AU", "CA", "DE", "FR", "GB", "IE", "NL", "NZ", "US"
|
|
|
|
);
|
|
|
|
}
|
2017-08-06 22:20:15 +02:00
|
|
|
|
|
|
|
@Override
|
2021-05-15 17:51:43 +02:00
|
|
|
public StreamExtractor getStreamExtractor(final LinkHandler linkHandler) {
|
|
|
|
return new SoundcloudStreamExtractor(this, linkHandler);
|
2017-08-06 22:20:15 +02:00
|
|
|
}
|
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
@Override
|
2021-05-15 17:51:43 +02:00
|
|
|
public ChannelExtractor getChannelExtractor(final ListLinkHandler linkHandler) {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new SoundcloudChannelExtractor(this, linkHandler);
|
2017-08-06 22:20:15 +02:00
|
|
|
}
|
|
|
|
|
2023-06-29 22:56:51 +02:00
|
|
|
@Override
|
|
|
|
public ChannelTabExtractor getChannelTabExtractor(final ListLinkHandler linkHandler) {
|
|
|
|
return new SoundcloudChannelTabExtractor(this, linkHandler);
|
|
|
|
}
|
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
@Override
|
2021-05-15 17:51:43 +02:00
|
|
|
public PlaylistExtractor getPlaylistExtractor(final ListLinkHandler linkHandler) {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new SoundcloudPlaylistExtractor(this, linkHandler);
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-05-15 17:51:43 +02:00
|
|
|
public SearchExtractor getSearchExtractor(final SearchQueryHandler queryHandler) {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new SoundcloudSearchExtractor(this, queryHandler);
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-04-28 22:03:16 +02:00
|
|
|
public SoundcloudSuggestionExtractor getSuggestionExtractor() {
|
|
|
|
return new SoundcloudSuggestionExtractor(this);
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
@Override
|
2018-10-05 16:01:10 +02:00
|
|
|
public KioskList getKioskList() throws ExtractionException {
|
2023-06-29 22:56:51 +02:00
|
|
|
final KioskList list = new KioskList(this);
|
|
|
|
|
|
|
|
final SoundcloudChartsLinkHandlerFactory h =
|
|
|
|
SoundcloudChartsLinkHandlerFactory.getInstance();
|
2021-05-15 17:51:43 +02:00
|
|
|
final KioskList.KioskExtractorFactory chartsFactory = (streamingService, url, id) ->
|
|
|
|
new SoundcloudChartsExtractor(SoundcloudService.this,
|
2023-06-29 22:56:51 +02:00
|
|
|
h.fromUrl(url), id);
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
// add kiosks here e.g.:
|
2017-08-20 10:03:41 +02:00
|
|
|
try {
|
2017-09-25 12:43:40 +02:00
|
|
|
list.addKioskEntry(chartsFactory, h, "Top 50");
|
|
|
|
list.addKioskEntry(chartsFactory, h, "New & hot");
|
2019-03-10 21:44:58 +01:00
|
|
|
list.setDefaultKiosk("New & hot");
|
2021-05-15 17:51:43 +02:00
|
|
|
} catch (final Exception e) {
|
2017-08-20 10:03:41 +02:00
|
|
|
throw new ExtractionException(e);
|
|
|
|
}
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
2018-02-22 15:52:38 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public SubscriptionExtractor getSubscriptionExtractor() {
|
|
|
|
return new SoundcloudSubscriptionExtractor(this);
|
|
|
|
}
|
2018-08-20 00:52:19 +02:00
|
|
|
|
2020-02-08 23:58:46 +01:00
|
|
|
@Override
|
|
|
|
public ListLinkHandlerFactory getCommentsLHFactory() {
|
2020-04-10 14:48:11 +02:00
|
|
|
return SoundcloudCommentsLinkHandlerFactory.getInstance();
|
2020-02-08 23:58:46 +01:00
|
|
|
}
|
2018-08-20 00:52:19 +02:00
|
|
|
|
2020-02-08 23:58:46 +01:00
|
|
|
@Override
|
2021-05-15 17:51:43 +02:00
|
|
|
public CommentsExtractor getCommentsExtractor(final ListLinkHandler linkHandler)
|
2018-09-29 09:49:00 +02:00
|
|
|
throws ExtractionException {
|
2020-04-10 14:48:11 +02:00
|
|
|
return new SoundcloudCommentsExtractor(this, linkHandler);
|
2018-09-29 09:49:00 +02:00
|
|
|
}
|
2017-08-04 16:21:45 +02:00
|
|
|
}
|