From d07f6cdef7ebc4a1d6f0cb977e474fcf5b904aca Mon Sep 17 00:00:00 2001 From: wb9688 Date: Tue, 22 Aug 2017 14:47:51 +0200 Subject: [PATCH] Use content country if supported by SoundCloud --- .../services/soundcloud/SoundcloudChartsExtractor.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java index f4aca4e2..cb83c72e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java @@ -1,6 +1,8 @@ package org.schabi.newpipe.extractor.services.soundcloud; import java.io.IOException; +import java.util.Arrays; +import java.util.List; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.UrlIdHandler; @@ -57,6 +59,12 @@ public class SoundcloudChartsExtractor extends KioskExtractor { apiUrl += "&kind=new"; } + List supportedCountries = Arrays.asList("AU", "CA", "FR", "DE", "IE", "NL", "NZ", "GB", "US"); + String contentCountry = getContentCountry(); + if (supportedCountries.contains(contentCountry)) { + apiUrl += "®ion=soundcloud:regions:" + contentCountry; + } + nextStreamsUrl = SoundcloudParsingHelper.getStreamsFromApi(collector, apiUrl, true); return collector; }