mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 16:30:29 +05:30
Merge pull request #401 from TeamPiped/channel-tab-nextpage
Fix channel tab nextpage.
This commit is contained in:
commit
1157d5dfaa
@ -351,20 +351,26 @@ public class ResponseHelper {
|
||||
return mapper.writeValueAsBytes(new ChannelTabData(nextpage, items));
|
||||
}
|
||||
|
||||
public static byte[] channelTabPageResponse(String data, String nextpage) throws Exception {
|
||||
public static byte[] channelTabPageResponse(String data, String prevPageStr) throws Exception {
|
||||
|
||||
if (StringUtils.isEmpty(data))
|
||||
return mapper.writeValueAsBytes(new InvalidRequestResponse());
|
||||
|
||||
YouTubeChannelTabHandler tabHandler = mapper.readValue(data, YouTubeChannelTabHandlerMixin.class);
|
||||
|
||||
Page nextPage = mapper.readValue(nextpage, Page.class);
|
||||
Page prevPage = mapper.readValue(prevPageStr, Page.class);
|
||||
|
||||
var info = ChannelTabInfo.getMoreItems(YOUTUBE_SERVICE, tabHandler, nextPage);
|
||||
var info = ChannelTabInfo.getMoreItems(YOUTUBE_SERVICE, tabHandler, prevPage);
|
||||
|
||||
String nextpage = null;
|
||||
if (info.hasNextPage()) {
|
||||
Page page = info.getNextPage();
|
||||
nextpage = mapper.writeValueAsString(page);
|
||||
}
|
||||
|
||||
List<ContentItem> items = collectRelatedItems(info.getItems());
|
||||
|
||||
return mapper.writeValueAsBytes(new ChannelTabData(null, items));
|
||||
return mapper.writeValueAsBytes(new ChannelTabData(nextpage, items));
|
||||
}
|
||||
|
||||
public static byte[] trendingResponse(String region)
|
||||
|
Loading…
x
Reference in New Issue
Block a user