Skip to content

Commit 81da2b2

Browse files
committed
Fix SoundcloudCommentsExtractor to handle null page URLs and improve next_href handling
1 parent 1875788 commit 81da2b2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public InfoItemsPage<CommentsInfoItem> getInitialPage() throws ExtractionExcepti
4141
public InfoItemsPage<CommentsInfoItem> getPage(final Page page) throws ExtractionException,
4242
IOException {
4343
if (page == null || isNullOrEmpty(page.getUrl())) {
44-
throw new IllegalArgumentException("Page doesn't contain an URL");
44+
return InfoItemsPage.emptyPage();
4545
}
4646
return getPage(page.getUrl());
4747
}
@@ -63,7 +63,8 @@ private InfoItemsPage<CommentsInfoItem> getPage(@Nonnull final String url)
6363
getServiceId());
6464

6565
collectStreamsFrom(collector, json.getArray("collection"));
66-
return new InfoItemsPage<>(collector, new Page(json.getString("next_href", null)));
66+
final String nextHref = json.getString("next_href");
67+
return new InfoItemsPage<>(collector, isNullOrEmpty(nextHref) ? null : new Page(nextHref));
6768
}
6869

6970
@Override

0 commit comments

Comments
 (0)