Fix for requested changes.
This commit is contained in:
parent
0aad09fa22
commit
6aabdc6d16
2 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue