mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
refactor: migrate parsers to TS (#133)
* dev: finish top-level parsers TS migration
* dev: migrate menu renderers to TS
* chore: fix ts errors
* dev: finish ts migration 🎉
This commit is contained in:
31
src/parser/classes/ChannelHeaderLinks.ts
Normal file
31
src/parser/classes/ChannelHeaderLinks.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import NavigationEndpoint from './NavigationEndpoint';
|
||||
import Text from './misc/Text';
|
||||
import Thumbnail from './misc/Thumbnail';
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class HeaderLink {
|
||||
endpoint: NavigationEndpoint;
|
||||
icon: Thumbnail[];
|
||||
title: Text;
|
||||
|
||||
constructor(data: any) {
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
||||
this.icon = Thumbnail.fromResponse(data.icon);
|
||||
this.title = new Text(data.title);
|
||||
}
|
||||
}
|
||||
|
||||
class ChannelHeaderLinks extends YTNode {
|
||||
static type = 'ChannelHeaderLinks';
|
||||
|
||||
primary: HeaderLink[];
|
||||
secondary: HeaderLink[];
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
this.primary = data.primaryLinks?.map((link: any) => new HeaderLink(link)) || [];
|
||||
this.secondary = data.secondaryLinks?.map((link: any) => new HeaderLink(link)) || [];
|
||||
}
|
||||
}
|
||||
|
||||
export default ChannelHeaderLinks;
|
||||
Reference in New Issue
Block a user