Merge pull request #1014 from TeamNewPipe/fix/yt-comments
[YouTube] Fix getting next comments pages
This commit is contained in:
commit
c589a2c1a2
|
@ -179,7 +179,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
|
||||||
.getBytes(StandardCharsets.UTF_8);
|
.getBytes(StandardCharsets.UTF_8);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
final var jsonObject = getJsonPostResponse("next", body, localization);
|
final JsonObject jsonObject = getJsonPostResponse("next", body, localization);
|
||||||
|
|
||||||
return extractComments(jsonObject);
|
return extractComments(jsonObject);
|
||||||
}
|
}
|
||||||
|
@ -188,15 +188,16 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
|
||||||
throws ExtractionException {
|
throws ExtractionException {
|
||||||
final CommentsInfoItemsCollector collector = new CommentsInfoItemsCollector(
|
final CommentsInfoItemsCollector collector = new CommentsInfoItemsCollector(
|
||||||
getServiceId());
|
getServiceId());
|
||||||
collectCommentsFrom(collector);
|
collectCommentsFrom(collector, jsonObject);
|
||||||
return new InfoItemsPage<>(collector, getNextPage(jsonObject));
|
return new InfoItemsPage<>(collector, getNextPage(jsonObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectCommentsFrom(final CommentsInfoItemsCollector collector)
|
private void collectCommentsFrom(final CommentsInfoItemsCollector collector,
|
||||||
|
final JsonObject jsonObject)
|
||||||
throws ParsingException {
|
throws ParsingException {
|
||||||
|
|
||||||
final JsonArray onResponseReceivedEndpoints =
|
final JsonArray onResponseReceivedEndpoints =
|
||||||
ajaxJson.getArray("onResponseReceivedEndpoints");
|
jsonObject.getArray("onResponseReceivedEndpoints");
|
||||||
// Prevent ArrayIndexOutOfBoundsException
|
// Prevent ArrayIndexOutOfBoundsException
|
||||||
if (onResponseReceivedEndpoints.isEmpty()) {
|
if (onResponseReceivedEndpoints.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue