From 3b4f5274e66fe7ba35ef8ddc979d4ff19b9a102b Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 7 Dec 2022 23:13:10 +0000 Subject: [PATCH] Update NPE. --- build.gradle | 2 +- .../java/me/kavin/piped/server/handlers/StreamHandlers.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 2bf32d6..7854fc6 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ dependencies { implementation 'it.unimi.dsi:fastutil-core:8.5.11' implementation 'commons-codec:commons-codec:1.15' implementation 'org.bouncycastle:bcprov-jdk15on:1.70' - implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:dd2983fe260c8e9b63a8187991bbf990c08f6e1c' + implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:85bff7662e56f5570dd0e5f8b666b4ffaf57a3b0' implementation 'com.github.FireMasterK:nanojson:c3c2bc80ee295e5c810b61d610951519ccf32b00' implementation 'com.fasterxml.jackson.core:jackson-core:2.14.1' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.1' diff --git a/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java b/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java index 6725981..17e1727 100644 --- a/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java +++ b/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java @@ -22,11 +22,13 @@ import org.schabi.newpipe.extractor.comments.CommentsInfo; import org.schabi.newpipe.extractor.comments.CommentsInfoItem; import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; import org.schabi.newpipe.extractor.exceptions.GeographicRestrictionException; +import org.schabi.newpipe.extractor.stream.Description; import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.utils.JsonUtils; import java.io.IOException; import java.util.List; +import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -311,7 +313,7 @@ public class StreamHandlers { repliespage = mapper.writeValueAsString(comment.getReplies()); comments.add(new Comment(comment.getUploaderName(), rewriteURL(comment.getUploaderAvatarUrl()), - comment.getCommentId(), comment.getCommentText().getContent(), comment.getTextualUploadDate(), + comment.getCommentId(), Optional.ofNullable(comment.getCommentText()).map(Description::getContent).orElse(null), comment.getTextualUploadDate(), substringYouTube(comment.getUploaderUrl()), repliespage, comment.getLikeCount(), comment.getReplyCount(), comment.isHeartedByUploader(), comment.isPinned(), comment.isUploaderVerified())); } catch (JsonProcessingException e) { @@ -349,7 +351,7 @@ public class StreamHandlers { repliespage = mapper.writeValueAsString(comment.getReplies()); comments.add(new Comment(comment.getUploaderName(), rewriteURL(comment.getUploaderAvatarUrl()), - comment.getCommentId(), comment.getCommentText().getContent(), comment.getTextualUploadDate(), + comment.getCommentId(), Optional.ofNullable(comment.getCommentText()).map(Description::getContent).orElse(null), comment.getTextualUploadDate(), substringYouTube(comment.getUploaderUrl()), repliespage, comment.getLikeCount(), comment.getReplyCount(), comment.isHeartedByUploader(), comment.isPinned(), comment.isUploaderVerified())); } catch (JsonProcessingException e) {