mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Update NPE fork and fix comments.
This commit is contained in:
parent
cedb862c20
commit
3bc9d05fc4
3 changed files with 14 additions and 10 deletions
|
@ -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'
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<CommentsInfoItem> info = CommentsInfo.getMoreItems(init, new Page(url));
|
||||
InfoItemsPage<CommentsInfoItem> info = CommentsInfo.getMoreItems(init, prevpage);
|
||||
|
||||
List<Comment> 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue