@sushibtw/youtubei
Version:
Simple package to get information from youtube such as videos, playlists, channels, video information & comments, related videos, up next video, and more!
32 lines (31 loc) • 946 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
/** Represents a chat in a live stream */
class Chat extends _1.Base {
/** @hidden */
constructor(chat = {}) {
super();
Object.assign(this, chat);
}
/**
* Load this instance with raw data from Youtube
*
* @hidden
*/
load(data) {
const { id, message, authorName, authorPhoto, timestampUsec, authorExternalChannelId, } = data;
// Basic information
this.id = id;
this.message = message.runs.map((r) => r.text).join("");
this.author = new _1.Channel({
id: authorExternalChannelId,
name: authorName.simpleText,
thumbnails: authorPhoto.thumbnails,
client: this.client,
});
this.timestamp = +timestampUsec;
return this;
}
}
exports.default = Chat;