mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
feat(CompactLink): Parse subtitle, iconType, and iconType
This commit is contained in:
@@ -6,14 +6,27 @@ import type { RawNode } from '../index.js';
|
||||
export default class CompactLink extends YTNode {
|
||||
static type = 'CompactLink';
|
||||
|
||||
title: string;
|
||||
endpoint: NavigationEndpoint;
|
||||
style: string;
|
||||
public title: string;
|
||||
public subtitle?: Text;
|
||||
public endpoint: NavigationEndpoint;
|
||||
public style: string;
|
||||
public icon_type?: string;
|
||||
public secondary_icon_type?: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.title = new Text(data.title).toString();
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
||||
|
||||
if ('subtitle' in data)
|
||||
this.subtitle = new Text(data.subtitle);
|
||||
|
||||
if ('icon' in data && 'iconType' in data.icon)
|
||||
this.icon_type = data.icon.iconType;
|
||||
|
||||
if ('secondaryIcon' in data && 'iconType' in data.secondaryIcon)
|
||||
this.secondary_icon_type = data.secondaryIcon.iconType;
|
||||
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
|
||||
this.style = data.style;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user