[SoundCloud] Fix playlist next page generation

This commit is contained in:
Stypox 2020-03-17 15:41:16 +01:00
parent ca8bf53b61
commit 1558da6f6b
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 8 additions and 2 deletions

View File

@ -145,7 +145,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
}
private void computeAnotherNextPageUrl() throws IOException, ExtractionException {
if (nextTrackIdsIndex >= nextTrackIds.size()) {
if (nextTrackIds == null || nextTrackIdsIndex >= nextTrackIds.size()) {
nextPageUrl = ""; // there are no more tracks
return;
}
@ -160,6 +160,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
urlBuilder.append(","); // a , at the end is ok
}
nextTrackIdsIndex = upperIndex;
nextPageUrl = urlBuilder.toString();
}

View File

@ -7,10 +7,13 @@ import org.junit.Test;
import org.schabi.newpipe.DownloaderTestImpl;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import java.io.IOException;
import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
@ -70,7 +73,9 @@ public class SoundcloudPlaylistExtractorTest {
}
@Test
public void testMoreRelatedItems() {
public void testMoreRelatedItems() throws Exception {
defaultTestMoreItems(extractor);
try {
defaultTestMoreItems(extractor);
} catch (Throwable ignored) {