mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-16 19:12:24 +00:00
refactor(kids/Channel): Use new endpoint parsers for continuation requests
This commit is contained in:
@@ -2,6 +2,7 @@ import Feed from '../../core/mixins/Feed.js';
|
||||
import C4TabbedHeader from '../classes/C4TabbedHeader.js';
|
||||
import ItemSection from '../classes/ItemSection.js';
|
||||
import { ItemSectionContinuation } from '../index.js';
|
||||
import NavigationEndpoint from '../classes/NavigationEndpoint.js';
|
||||
|
||||
import type { IBrowseResponse } from '../types/index.js';
|
||||
import type { ApiResponse, Actions } from '../../core/index.js';
|
||||
@@ -17,15 +18,22 @@ export default class Channel extends Feed<IBrowseResponse> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves next batch of videos.
|
||||
* Retrieves next batch of content.
|
||||
*/
|
||||
async getContinuation(): Promise<Channel> {
|
||||
const response = await this.actions.execute('/browse', {
|
||||
continuation: this.contents?.continuation,
|
||||
client: 'YTKIDS'
|
||||
if (!this.contents)
|
||||
throw new Error('No continuation available.');
|
||||
|
||||
const continuation_request = new NavigationEndpoint({
|
||||
continuationCommand: {
|
||||
token: this.contents.continuation,
|
||||
request: 'CONTINUATION_REQUEST_TYPE_BROWSE'
|
||||
}
|
||||
});
|
||||
|
||||
const continuation_response = await continuation_request.call(this.actions, { client: 'YTKIDS' });
|
||||
|
||||
return new Channel(this.actions, response);
|
||||
return new Channel(this.actions, continuation_response);
|
||||
}
|
||||
|
||||
get has_continuation(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user