From 1a67ea100ad9a930462b2a37b9fe02e879b1e86d Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Mon, 21 Feb 2022 19:55:33 +0100 Subject: [PATCH] Refactored code according to review --- .../youtube/extractors/YoutubeCommentsExtractor.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsExtractor.java index 32cf559bb..f62b60f67 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeCommentsExtractor.java @@ -73,7 +73,8 @@ public class YoutubeCommentsExtractor extends CommentsExtractor { /** * Finds the initial comments token and initializes commentsDisabled. - * Also set + *
+ * Also sets {@link #optCommentsDisabled}. * * @return the continuation token or null if none was found */ @@ -85,14 +86,12 @@ public class YoutubeCommentsExtractor extends CommentsExtractor { // Only use JsonObjects .filter(JsonObject.class::isInstance) .map(JsonObject.class::cast) - // Only process JsonObjects that have a itemSectionRenderer - .filter(jObj -> jObj.has("itemSectionRenderer")) // Check if the comment-section is present .filter(jObj -> { try { return "comments-section".equals( JsonUtils.getString(jObj, "itemSectionRenderer.targetId")); - } catch (final ParsingException ex) { + } catch (final ParsingException ignored) { return false; } }) @@ -105,7 +104,7 @@ public class YoutubeCommentsExtractor extends CommentsExtractor { .getObject("itemSectionRenderer") .getArray("contents").getObject(0), "continuationItemRenderer.continuationEndpoint.continuationCommand.token"); - } catch (final ParsingException ex) { + } catch (final ParsingException ignored) { return null; } })