diff --git a/build.gradle b/build.gradle index 852bf06..b3da584 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ dependencies { implementation 'it.unimi.dsi:fastutil-core:8.5.4' implementation 'commons-codec:commons-codec:1.15' implementation 'org.bouncycastle:bcprov-jdk15on:1.69' - implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:b603630729f669a28a43b708520131f66fa45a0f' + implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:cd75149f661fb6ae7b7398a149a6661d51afee45' implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4' diff --git a/src/main/java/me/kavin/piped/ServerLauncher.java b/src/main/java/me/kavin/piped/ServerLauncher.java index 4e81dfc..a145b56 100644 --- a/src/main/java/me/kavin/piped/ServerLauncher.java +++ b/src/main/java/me/kavin/piped/ServerLauncher.java @@ -188,7 +188,7 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher { })).map(GET, "/nextpage/comments/:videoId", AsyncServlet.ofBlocking(executor, request -> { try { return getJsonResponse(ResponseHelper.commentsPageResponse(request.getPathParameter("videoId"), - request.getQueryParameter("url")), "public, max-age=3600"); + request.getQueryParameter("nextpage")), "public, max-age=3600"); } catch (Exception e) { return getErrorResponse(e); } diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 1854527..28e6b35 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -482,9 +482,10 @@ public class ResponseHelper { }); String nextpage = null; - - if (info.getNextPage() != null) - nextpage = info.getNextPage().getUrl(); + if (info.hasNextPage()) { + Page page = info.getNextPage(); + nextpage = Constants.mapper.writeValueAsString(page); + } CommentsPage commentsItem = new CommentsPage(comments, nextpage); @@ -492,11 +493,13 @@ public class ResponseHelper { } - public static final byte[] commentsPageResponse(String videoId, String url) throws Exception { + public static final byte[] commentsPageResponse(String videoId, String prevpageStr) throws Exception { + + Page prevpage = Constants.mapper.readValue(prevpageStr, Page.class); CommentsInfo init = commentsCache.get(videoId); - InfoItemsPage info = CommentsInfo.getMoreItems(init, new Page(url)); + InfoItemsPage info = CommentsInfo.getMoreItems(init, prevpage); List comments = new ObjectArrayList<>(); @@ -508,9 +511,10 @@ public class ResponseHelper { }); String nextpage = null; - - if (info.getNextPage() != null) - nextpage = info.getNextPage().getUrl(); + if (info.hasNextPage()) { + Page page = info.getNextPage(); + nextpage = Constants.mapper.writeValueAsString(page); + } CommentsPage commentsItem = new CommentsPage(comments, nextpage);