Skip to content

Commit e792666

Browse files
litetexStypox
authored andcommitted
[SoundCloud] Purged Top 50
They no longer exists and the API returns nothing for them. Overall SoundCloud seems to use a new system.
1 parent e7dcc97 commit e792666

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ public void onFetchPage(@Nonnull final Downloader downloader)
4040

4141
initialFetchCollector = new StreamInfoItemsCollector(getServiceId());
4242

43-
String apiUrl = SOUNDCLOUD_API_V2_URL + "charts" + "?genre=soundcloud:genres:all-music"
44-
+ "&client_id=" + SoundcloudParsingHelper.clientId();
45-
46-
if (getId().equals("Top 50")) {
47-
apiUrl += "&kind=top";
48-
} else {
49-
apiUrl += "&kind=trending";
50-
}
43+
final String apiUrl = SOUNDCLOUD_API_V2_URL + "charts"
44+
+ "?genre=soundcloud:genres:all-music"
45+
+ "&client_id=" + SoundcloudParsingHelper.clientId()
46+
+ "&kind=trending";
5147

5248
final ContentCountry contentCountry = SoundCloud.getContentCountry();
5349
String apiUrlWithRegion = null;

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/linkHandler/SoundcloudChartsLinkHandlerFactory.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public final class SoundcloudChartsLinkHandlerFactory extends ListLinkHandlerFac
1111
private static final SoundcloudChartsLinkHandlerFactory INSTANCE =
1212
new SoundcloudChartsLinkHandlerFactory();
1313

14-
private static final String TOP_URL_PATTERN =
15-
"^https?://(www\\.|m\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$";
1614
private static final String URL_PATTERN =
1715
"^https?://(www\\.|m\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$";
1816

@@ -25,23 +23,15 @@ public static SoundcloudChartsLinkHandlerFactory getInstance() {
2523

2624
@Override
2725
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
28-
if (Parser.isMatch(TOP_URL_PATTERN, url.toLowerCase())) {
29-
return "Top 50";
30-
} else {
31-
return "New & hot";
32-
}
26+
return "New & hot";
3327
}
3428

3529
@Override
3630
public String getUrl(final String id,
3731
final List<String> contentFilter,
3832
final String sortFilter)
3933
throws ParsingException, UnsupportedOperationException {
40-
if (id.equals("Top 50")) {
41-
return "https://soundcloud.com/charts/top";
42-
} else {
43-
return "https://soundcloud.com/charts/new";
44-
}
34+
return "https://soundcloud.com/charts/new";
4535
}
4636

4737
@Override

extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsLinkHandlerFactoryTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ public static void setUp() {
2424

2525
@Test
2626
public void getUrl() throws Exception {
27-
assertEquals("https://soundcloud.com/charts/top", linkHandler.fromId("Top 50").getUrl());
2827
assertEquals("https://soundcloud.com/charts/new", linkHandler.fromId("New & hot").getUrl());
2928
}
3029

3130
@Test
3231
public void getId() throws ParsingException {
33-
assertEquals("Top 50", linkHandler.fromUrl("http://soundcloud.com/charts/top?genre=all-music").getId());
3432
assertEquals("New & hot", linkHandler.fromUrl("HTTP://www.soundcloud.com/charts/new/?genre=all-music&country=all-countries").getId());
3533
}
3634

0 commit comments

Comments
 (0)