Files
YouTube.js/lib/parser/classes/comments/CommentsHeader.js
LuanRT 68cb841c00 refactor!: finish parser migration
Finally! :)

This removes all code related to the old parser.

#65
2022-07-11 06:19:10 -03:00

27 lines
780 B
JavaScript

'use strict';
const Parser = require('../..');
const Text = require('../Text');
const Thumbnail = require('../Thumbnail');
class CommentsHeader {
type = 'CommentsHeader';
constructor(data) {
this.title = new Text(data.titleText);
this.count = new Text(data.countText);
this.comments_count = new Text(data.commentsCount);
this.create_renderer = Parser.parse(data.createRenderer, 'comments');
this.sort_menu = Parser.parse(data.sortMenu);
this.custom_emojis = data.customEmojis?.map((emoji) => ({
emoji_id: emoji.emojiId,
shortcuts: emoji.shortcuts,
search_terms: emoji.searchTerms,
image: Thumbnail.fromResponse(emoji.image),
is_custom_emoji: emoji.isCustomEmoji
})) || null;
}
}
module.exports = CommentsHeader;