@np-dev/youtubei-js
Version:
A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).
33 lines • 1.43 kB
JavaScript
import { YTNode } from '../helpers.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import ContentPreviewImageView from './ContentPreviewImageView.js';
import { Parser } from '../index.js';
import Thumbnail from './misc/Thumbnail.js';
class VideoAttributeView extends YTNode {
constructor(data) {
var _a;
super();
// @NOTE: "image" is not a renderer so not sure why we're parsing it as one. Leaving this hack here for now to avoid breaking things.
if ((_a = data.image) === null || _a === void 0 ? void 0 : _a.sources) {
this.image = {
sources: data.image.sources.map((x) => new Thumbnail(x)).sort((a, b) => b.width - a.width)
};
}
else {
this.image = Parser.parseItem(data.image, ContentPreviewImageView);
}
this.image_style = data.imageStyle;
this.title = data.title;
this.subtitle = data.subtitle;
this.secondary_subtitle = {
content: data.secondarySubtitle.content
};
this.orientation = data.orientation;
this.sizing_rule = data.sizingRule;
this.overflow_menu_on_tap = new NavigationEndpoint(data.overflowMenuOnTap);
this.overflow_menu_a11y_label = data.overflowMenuA11yLabel;
}
}
VideoAttributeView.type = 'VideoAttributeView';
export default VideoAttributeView;
//# sourceMappingURL=VideoAttributeView.js.map