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); 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; final List<Object> comments;
try { try {
comments = JsonUtils.getValues(contents, comments = JsonUtils.getValues(contents, jsonKey);
jsonKey);
} catch (final Exception e) { } catch (final Exception e) {
throw new ParsingException("Unable to get parse youtube comments", 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"); final String id = JsonUtils.getString(JsonUtils.getArray(json, "replies.commentRepliesRenderer.contents").getObject(0), "continuationItemRenderer.continuationEndpoint.continuationCommand.token");
return new Page(url, id); return new Page(url, id);
} catch (final Exception e) { } catch (final Exception e) {
return null; return null; // Would return null for Comment Replies, since YouTube does not support nested replies.
} }
} }
} }