Fix for requested changes.

This commit is contained in:
FireMasterK 2021-09-12 01:09:10 +05:30
parent 0aad09fa22
commit 6aabdc6d16
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 3 additions and 4 deletions

View File

@ -215,12 +215,11 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
contents.remove(index);
}
String jsonKey = contents.getObject(0).has("commentThreadRenderer") ? "commentThreadRenderer" : "commentRenderer";
final String jsonKey = contents.getObject(0).has("commentThreadRenderer") ? "commentThreadRenderer" : "commentRenderer";
final List<Object> comments;
try {
comments = JsonUtils.getValues(contents,
jsonKey);
comments = JsonUtils.getValues(contents, jsonKey);
} catch (final Exception e) {
throw new ParsingException("Unable to get parse youtube comments", e);
}

View File

@ -250,7 +250,7 @@ public class YoutubeCommentsInfoItemExtractor implements CommentsInfoItemExtract
final String id = JsonUtils.getString(JsonUtils.getArray(json, "replies.commentRepliesRenderer.contents").getObject(0), "continuationItemRenderer.continuationEndpoint.continuationCommand.token");
return new Page(url, id);
} catch (final Exception e) {
return null;
return null; // Would return null for Comment Replies, since YouTube does not support nested replies.
}
}
}