From eb44b719396f30f8cdbd50af15829b2a76029d0f Mon Sep 17 00:00:00 2001 From: LuanRT Date: Sat, 10 Sep 2022 04:09:38 -0300 Subject: [PATCH] feat: add `CollaboratorInfoCardContent` renderer parser (#180) --- .../classes/CollaboratorInfoCardContent.ts | 26 +++++++++++++++++++ src/parser/map.ts | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 src/parser/classes/CollaboratorInfoCardContent.ts diff --git a/src/parser/classes/CollaboratorInfoCardContent.ts b/src/parser/classes/CollaboratorInfoCardContent.ts new file mode 100644 index 00000000..04409c5c --- /dev/null +++ b/src/parser/classes/CollaboratorInfoCardContent.ts @@ -0,0 +1,26 @@ +import Text from './misc/Text'; +import Thumbnail from './misc/Thumbnail'; +import NavigationEndpoint from './NavigationEndpoint'; + +import { YTNode } from '../helpers'; + +class CollaboratorInfoCardContent extends YTNode { + static type = 'CollaboratorInfoCardContent'; + + channel_avatar: Thumbnail[]; + custom_text: Text; + channel_name: Text; + subscriber_count: Text; + endpoint: NavigationEndpoint; + + constructor(data: any) { + super(); + this.channel_avatar = Thumbnail.fromResponse(data.channelAvatar); + this.custom_text = new Text(data.customText); + this.channel_name = new Text(data.channelName); + this.subscriber_count = new Text(data.subscriberCountText); + this.endpoint = new NavigationEndpoint(data.endpoint); + } +} + +export default CollaboratorInfoCardContent; \ No newline at end of file diff --git a/src/parser/map.ts b/src/parser/map.ts index 01ca67af..72462549 100644 --- a/src/parser/map.ts +++ b/src/parser/map.ts @@ -38,6 +38,7 @@ import { default as ChannelVideoPlayer } from './classes/ChannelVideoPlayer'; import { default as ChildVideo } from './classes/ChildVideo'; import { default as ChipCloud } from './classes/ChipCloud'; import { default as ChipCloudChip } from './classes/ChipCloudChip'; +import { default as CollaboratorInfoCardContent } from './classes/CollaboratorInfoCardContent'; import { default as CollageHeroImage } from './classes/CollageHeroImage'; import { default as AuthorCommentBadge } from './classes/comments/AuthorCommentBadge'; import { default as Comment } from './classes/comments/Comment'; @@ -305,6 +306,7 @@ const map: Record = { ChildVideo, ChipCloud, ChipCloudChip, + CollaboratorInfoCardContent, CollageHeroImage, AuthorCommentBadge, Comment,