Skip to content

Commit c589a2c

Browse files
authored
Merge pull request #1014 from TeamNewPipe/fix/yt-comments
[YouTube] Fix getting next comments pages
2 parents c2b36fd + f50b727 commit c589a2c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsExtractor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public InfoItemsPage<CommentsInfoItem> getPage(final Page page)
179179
.getBytes(StandardCharsets.UTF_8);
180180
// @formatter:on
181181

182-
final var jsonObject = getJsonPostResponse("next", body, localization);
182+
final JsonObject jsonObject = getJsonPostResponse("next", body, localization);
183183

184184
return extractComments(jsonObject);
185185
}
@@ -188,15 +188,16 @@ private InfoItemsPage<CommentsInfoItem> extractComments(final JsonObject jsonObj
188188
throws ExtractionException {
189189
final CommentsInfoItemsCollector collector = new CommentsInfoItemsCollector(
190190
getServiceId());
191-
collectCommentsFrom(collector);
191+
collectCommentsFrom(collector, jsonObject);
192192
return new InfoItemsPage<>(collector, getNextPage(jsonObject));
193193
}
194194

195-
private void collectCommentsFrom(final CommentsInfoItemsCollector collector)
195+
private void collectCommentsFrom(final CommentsInfoItemsCollector collector,
196+
final JsonObject jsonObject)
196197
throws ParsingException {
197198

198199
final JsonArray onResponseReceivedEndpoints =
199-
ajaxJson.getArray("onResponseReceivedEndpoints");
200+
jsonObject.getArray("onResponseReceivedEndpoints");
200201
// Prevent ArrayIndexOutOfBoundsException
201202
if (onResponseReceivedEndpoints.isEmpty()) {
202203
return;

0 commit comments

Comments
 (0)