mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 03:59:38 +00:00
* feat(utils): Add logger * chore: Clean up some classes and add more logging * chore: Fix conflicts
26 lines
851 B
TypeScript
26 lines
851 B
TypeScript
import Feed from '../../core/mixins/Feed.js';
|
|
import ItemSection from '../classes/ItemSection.js';
|
|
import { InnertubeError } from '../../utils/Utils.js';
|
|
|
|
import type { ApiResponse, Actions } from '../../core/index.js';
|
|
import type { ObservedArray, YTNode } from '../helpers.js';
|
|
import type { ISearchResponse } from '../types/index.js';
|
|
|
|
class Search extends Feed<ISearchResponse> {
|
|
estimated_results: number;
|
|
contents: ObservedArray<YTNode> | null;
|
|
|
|
constructor(actions: Actions, data: ApiResponse | ISearchResponse) {
|
|
super(actions, data);
|
|
this.estimated_results = this.page.estimated_results;
|
|
|
|
const item_section = this.memo.getType(ItemSection).first();
|
|
|
|
if (!item_section)
|
|
throw new InnertubeError('No item section found in search response.');
|
|
|
|
this.contents = item_section.contents;
|
|
}
|
|
}
|
|
|
|
export default Search; |