Skip to content

Commit

Permalink
Fix for requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Feb 10, 2022
1 parent df708a7 commit 0616b5d
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,18 @@ public boolean isCommentsDisabled() throws ExtractionException {

@Override
public int getCommentsCount() throws ExtractionException {
final JsonObject commentsHeaderRenderer = ajaxJson
final JsonObject countText = ajaxJson
.getArray("onResponseReceivedEndpoints").getObject(0)
.getObject("reloadContinuationItemsCommand")
.getArray("continuationItems").getObject(0)
.getObject("commentsHeaderRenderer");
.getObject("commentsHeaderRenderer")
.getObject("countText");

final String text = getTextFromObject(commentsHeaderRenderer.getObject("countText"));

return Integer.parseInt(Utils.removeNonDigitCharacters(text));
try {
final String text = getTextFromObject(countText);
return Integer.parseInt(Utils.removeNonDigitCharacters(text));
} catch (final Exception e) {
throw new ExtractionException("Unable to get comments count", e);
}
}
}

0 comments on commit 0616b5d

Please sign in to comment.