Skip to content

Commit 1558da6

Browse files
committed
[SoundCloud] Fix playlist next page generation
1 parent ca8bf53 commit 1558da6

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void computeInitialTracksAndNextIds() {
145145
}
146146

147147
private void computeAnotherNextPageUrl() throws IOException, ExtractionException {
148-
if (nextTrackIdsIndex >= nextTrackIds.size()) {
148+
if (nextTrackIds == null || nextTrackIdsIndex >= nextTrackIds.size()) {
149149
nextPageUrl = ""; // there are no more tracks
150150
return;
151151
}
@@ -160,6 +160,7 @@ private void computeAnotherNextPageUrl() throws IOException, ExtractionException
160160
urlBuilder.append(","); // a , at the end is ok
161161
}
162162

163+
nextTrackIdsIndex = upperIndex;
163164
nextPageUrl = urlBuilder.toString();
164165
}
165166

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import org.schabi.newpipe.DownloaderTestImpl;
88
import org.schabi.newpipe.extractor.ListExtractor;
99
import org.schabi.newpipe.extractor.NewPipe;
10+
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
1011
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
1112
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
1213
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1314

15+
import java.io.IOException;
16+
1417
import static org.junit.Assert.*;
1518
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
1619
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
@@ -70,7 +73,9 @@ public void testRelatedItems() throws Exception {
7073
}
7174

7275
@Test
73-
public void testMoreRelatedItems() {
76+
public void testMoreRelatedItems() throws Exception {
77+
defaultTestMoreItems(extractor);
78+
7479
try {
7580
defaultTestMoreItems(extractor);
7681
} catch (Throwable ignored) {

0 commit comments

Comments
 (0)