From 5f233ae34e278e7f7a0c48e4ba762d9bac9e312f Mon Sep 17 00:00:00 2001 From: Luan Date: Tue, 10 Dec 2024 18:32:31 -0300 Subject: [PATCH] feat(parser): Add `ActiveAccountHeader` Found on the 'You' (a.k.a, 'Library') page. --- src/parser/classes/ActiveAccountHeader.ts | 24 +++++++++++++++++++++++ src/parser/nodes.ts | 1 + 2 files changed, 25 insertions(+) create mode 100644 src/parser/classes/ActiveAccountHeader.ts diff --git a/src/parser/classes/ActiveAccountHeader.ts b/src/parser/classes/ActiveAccountHeader.ts new file mode 100644 index 000000000..ad6fd40f6 --- /dev/null +++ b/src/parser/classes/ActiveAccountHeader.ts @@ -0,0 +1,24 @@ +import { YTNode } from '../helpers.js'; +import { type RawNode } from '../index.js'; +import Text from './misc/Text.js'; +import Thumbnail from './misc/Thumbnail.js'; +import NavigationEndpoint from './NavigationEndpoint.js'; + +export default class ActiveAccountHeader extends YTNode { + static type = 'ActiveAccountHeader'; + + public account_name: Text; + public account_photo: Thumbnail[]; + public endpoint: NavigationEndpoint; + public manage_account_title: Text; + public channel_handle: Text; + + constructor(data: RawNode) { + super(); + this.account_name = new Text(data.accountName); + this.account_photo = Thumbnail.fromResponse(data.accountPhoto); + this.endpoint = new NavigationEndpoint(data.serviceEndpoint); + this.manage_account_title = new Text(data.manageAccountTitle); + this.channel_handle = new Text(data.channelHandle); + } +} \ No newline at end of file diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index 579a4614f..a23778d1d 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -17,6 +17,7 @@ export { default as SignalAction } from './classes/actions/SignalAction.js'; export { default as UpdateChannelSwitcherPageAction } from './classes/actions/UpdateChannelSwitcherPageAction.js'; export { default as UpdateEngagementPanelAction } from './classes/actions/UpdateEngagementPanelAction.js'; export { default as UpdateSubscribeButtonAction } from './classes/actions/UpdateSubscribeButtonAction.js'; +export { default as ActiveAccountHeader } from './classes/ActiveAccountHeader.js'; export { default as AddToPlaylist } from './classes/AddToPlaylist.js'; export { default as Alert } from './classes/Alert.js'; export { default as AlertWithButton } from './classes/AlertWithButton.js';