Skip to content

Commit 094b87c

Browse files
authored
Merge pull request #299 from B0pol/sc_countries
add supported countries for soundcloud
2 parents a7d3d14 + 1eb3deb commit 094b87c

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import javax.annotation.Nonnull;
1212
import java.io.IOException;
1313

14+
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
15+
1416
public class SoundcloudChartsExtractor extends KioskExtractor<StreamInfoItem> {
1517
private StreamInfoItemsCollector collector = null;
1618
private String nextPageUrl = null;
@@ -57,11 +59,9 @@ private void computeNextPageAndStreams() throws IOException, ExtractionException
5759
apiUrl += "&kind=trending";
5860
}
5961

60-
/*List<String> supportedCountries = Arrays.asList("AU", "CA", "FR", "DE", "IE", "NL", "NZ", "GB", "US");
61-
String contentCountry = getContentCountry();
62-
if (supportedCountries.contains(contentCountry)) {
63-
apiUrl += "&region=soundcloud:regions:" + contentCountry;
64-
}*/
62+
63+
String contentCountry = SoundCloud.getContentCountry().getCountryCode();
64+
apiUrl += "&region=soundcloud:regions:" + contentCountry;
6565

6666
nextPageUrl = SoundcloudParsingHelper.getStreamsFromApi(collector, apiUrl, true);
6767
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
88
import org.schabi.newpipe.extractor.kiosk.KioskList;
99
import org.schabi.newpipe.extractor.linkhandler.*;
10+
import org.schabi.newpipe.extractor.localization.ContentCountry;
1011
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
1112
import org.schabi.newpipe.extractor.search.SearchExtractor;
1213
import org.schabi.newpipe.extractor.stream.StreamExtractor;
1314
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
1415

16+
import java.util.List;
17+
1518
import static java.util.Collections.singletonList;
1619
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
1720

@@ -46,6 +49,13 @@ public ListLinkHandlerFactory getPlaylistLHFactory() {
4649
return SoundcloudPlaylistLinkHandlerFactory.getInstance();
4750
}
4851

52+
@Override
53+
public List<ContentCountry> getSupportedCountries() {
54+
//Country selector here https://soundcloud.com/charts/top?genre=all-music
55+
return ContentCountry.listFrom(
56+
"AU", "CA", "DE", "FR", "GB", "IE", "NL", "NZ", "US"
57+
);
58+
}
4959

5060
@Override
5161
public StreamExtractor getStreamExtractor(LinkHandler LinkHandler) {

0 commit comments

Comments
 (0)