mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix channel continuation.
This commit is contained in:
parent
efc28a8994
commit
8e9547ef8d
2 changed files with 12 additions and 6 deletions
|
@ -188,21 +188,26 @@ public class ResponseHelper {
|
|||
public static final byte[] channelPageResponse(String channelId, String url, String id)
|
||||
throws IOException, ExtractionException, InterruptedException {
|
||||
|
||||
InfoItemsPage<StreamInfoItem> page = ChannelInfo.getMoreItems(Constants.YOUTUBE_SERVICE,
|
||||
InfoItemsPage<StreamInfoItem> info = ChannelInfo.getMoreItems(Constants.YOUTUBE_SERVICE,
|
||||
"https://youtube.com/channel/" + channelId, new Page(url, id));
|
||||
|
||||
final List<StreamItem> relatedStreams = new ObjectArrayList<>();
|
||||
|
||||
page.getItems().forEach(o -> {
|
||||
info.getItems().forEach(o -> {
|
||||
StreamInfoItem item = o;
|
||||
relatedStreams.add(new StreamItem(item.getUrl().substring(23), item.getName(),
|
||||
rewriteURL(item.getThumbnailUrl()), item.getUploaderName(), item.getUploaderUrl().substring(23),
|
||||
item.getTextualUploadDate(), item.getDuration(), item.getViewCount()));
|
||||
});
|
||||
|
||||
String nextpage = page.hasNextPage() ? page.getNextPage().getUrl() : null;
|
||||
String nextpage = null, next_id = null;
|
||||
if (info.hasNextPage()) {
|
||||
Page page = info.getNextPage();
|
||||
nextpage = page.getUrl();
|
||||
id = info.getNextPage().getId();
|
||||
}
|
||||
|
||||
final StreamsPage streamspage = new StreamsPage(nextpage, relatedStreams);
|
||||
final StreamsPage streamspage = new StreamsPage(nextpage, next_id, relatedStreams);
|
||||
|
||||
return Constants.mapper.writeValueAsBytes(streamspage);
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ import java.util.List;
|
|||
|
||||
public class StreamsPage {
|
||||
|
||||
public String nextpage;
|
||||
public String nextpage, nextid;
|
||||
public List<StreamItem> relatedStreams;
|
||||
|
||||
public StreamsPage(String nextpage, List<StreamItem> relatedStreams) {
|
||||
public StreamsPage(String nextpage, String nextid, List<StreamItem> relatedStreams) {
|
||||
this.nextpage = nextpage;
|
||||
this.nextid = nextid;
|
||||
this.relatedStreams = relatedStreams;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue