mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-23 23:09:28 +00:00
feat(YouTube/Search): add SearchSubMenu node (#340)
This commit is contained in:
22
src/parser/classes/SearchFilter.ts
Normal file
22
src/parser/classes/SearchFilter.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import Text from './misc/Text.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
|
||||
class SearchFilter extends YTNode {
|
||||
static type = 'SearchFilter';
|
||||
|
||||
label: Text;
|
||||
endpoint: NavigationEndpoint;
|
||||
tooltip: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
|
||||
this.label = new Text(data.label);
|
||||
this.endpoint = new NavigationEndpoint(data.endpoint);
|
||||
this.tooltip = data.tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
export default SearchFilter;
|
||||
20
src/parser/classes/SearchFilterGroup.ts
Normal file
20
src/parser/classes/SearchFilterGroup.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ObservedArray, YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import { Parser, YTNodes } from '../index.js';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
class SearchFilterGroup extends YTNode {
|
||||
static type = 'SearchFilterGroup';
|
||||
|
||||
title: Text;
|
||||
filters: ObservedArray<YTNodes.SearchFilter> | null;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
|
||||
this.title = new Text(data.title);
|
||||
this.filters = Parser.parseArray(data.filters, YTNodes.SearchFilter);
|
||||
}
|
||||
}
|
||||
|
||||
export default SearchFilterGroup;
|
||||
21
src/parser/classes/SearchSubMenu.ts
Normal file
21
src/parser/classes/SearchSubMenu.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ObservedArray, YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import Parser, { YTNodes } from '../index.js';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
class SearchSubMenu extends YTNode {
|
||||
static type = 'SearchSubMenu';
|
||||
|
||||
title: Text;
|
||||
groups: ObservedArray<YTNodes.SearchFilterGroup> | null;
|
||||
button: YTNodes.ToggleButton | null;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.title = new Text(data.title);
|
||||
this.groups = Parser.parseArray(data.groups, YTNodes.SearchFilterGroup);
|
||||
this.button = Parser.parseItem(data.button, YTNodes.ToggleButton);
|
||||
}
|
||||
}
|
||||
|
||||
export default SearchSubMenu;
|
||||
Reference in New Issue
Block a user