-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): Update
LiveChatTickerPaidStickerItem
(#848)
The `LiveChatTickerPaidStickerItem` class has been updated to extend `YTNode` instead of `LiveChatTickerPaidMessageItem` to better align with the latest data provided by InnerTube
- Loading branch information
Showing
1 changed file
with
37 additions
and
2 deletions.
There are no files selected for viewing
39 changes: 37 additions & 2 deletions
39
src/parser/classes/livechat/items/LiveChatTickerPaidStickerItem.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
import LiveChatTickerPaidMessageItem from './LiveChatTickerPaidMessageItem.js'; | ||
import { YTNode } from '../../../helpers.js'; | ||
import { Parser, type RawNode } from '../../../index.js'; | ||
import Thumbnail from '../../misc/Thumbnail.js'; | ||
import NavigationEndpoint from '../../NavigationEndpoint.js'; | ||
|
||
export default class LiveChatTickerPaidStickerItem extends LiveChatTickerPaidMessageItem { | ||
export default class LiveChatTickerPaidStickerItem extends YTNode { | ||
static type = 'LiveChatTickerPaidStickerItem'; | ||
|
||
id: string; | ||
author_external_channel_id: string; | ||
author_photo: Thumbnail[]; | ||
start_background_color: number; | ||
end_background_color: number; | ||
duration_sec: number; | ||
full_duration_sec: number; | ||
show_item: YTNode; | ||
show_item_endpoint: NavigationEndpoint; | ||
ticker_thumbnails: { | ||
thumbnails: Thumbnail[], | ||
label?: string, | ||
}[]; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.id = data.id; | ||
this.author_external_channel_id = data.authorExternalChannelId; | ||
this.author_photo = Thumbnail.fromResponse(data.authorPhoto); | ||
this.start_background_color = data.startBackgroundColor; | ||
this.end_background_color = data.endBackgroundColor; | ||
this.duration_sec = data.durationSec; | ||
this.full_duration_sec = data.fullDurationSec; | ||
this.show_item = Parser.parseItem(data.showItemEndpoint?.showLiveChatItemEndpoint?.renderer); | ||
this.show_item_endpoint = new NavigationEndpoint(data.showItemEndpoint); | ||
|
||
this.ticker_thumbnails = data.tickerThumbnails.map((item: any) => ({ | ||
thumbnails: Thumbnail.fromResponse(item), | ||
label: item?.accessibility?.accessibilityData?.label | ||
})); | ||
} | ||
} |