Skip to content

Commit

Permalink
feat(parser): add ChannelAgeGate node
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Feb 16, 2023
1 parent bf12740 commit 1cdf701
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/parser/classes/ChannelAgeGate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Parser } from '../index.js';
import Button from './Button.js';
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';

import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';

class ChannelAgeGate extends YTNode {
static type = 'channelAgeGate';

channel_title: string;
avatar: Thumbnail[];
header: Text;
main_text: Text;
sign_in_button: Button | null;
secondary_text: Text;

constructor(data: RawNode) {
super();
this.channel_title = data.channelTitle;
this.avatar = Thumbnail.fromResponse(data.avatar);
this.header = new Text(data.header);
this.main_text = new Text(data.mainText);
this.sign_in_button = Parser.parseItem<Button>(data.signInButton, Button);
this.secondary_text = new Text(data.secondaryText);
}
}

export default ChannelAgeGate;
2 changes: 2 additions & 0 deletions src/parser/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { default as CarouselHeader } from './classes/CarouselHeader.js';
import { default as CarouselItem } from './classes/CarouselItem.js';
import { default as Channel } from './classes/Channel.js';
import { default as ChannelAboutFullMetadata } from './classes/ChannelAboutFullMetadata.js';
import { default as ChannelAgeGate } from './classes/ChannelAgeGate.js';
import { default as ChannelFeaturedContent } from './classes/ChannelFeaturedContent.js';
import { default as ChannelHeaderLinks } from './classes/ChannelHeaderLinks.js';
import { default as ChannelMetadata } from './classes/ChannelMetadata.js';
Expand Down Expand Up @@ -364,6 +365,7 @@ export const YTNodes = {
CarouselItem,
Channel,
ChannelAboutFullMetadata,
ChannelAgeGate,
ChannelFeaturedContent,
ChannelHeaderLinks,
ChannelMetadata,
Expand Down

0 comments on commit 1cdf701

Please sign in to comment.