Files
YouTube.js/src/parser/classes/analytics/AnalyticsVideo.ts
Chinmay Kumar cfc1a183e0 refactor(parser): type YTNodes' data arg as RawNode (wip) (#339)
* replaced YTNode's data arg as RawNode

* updated documentation

* removed unused import

---- Note that there are still many nodes that need to be updated, hence the WIP status.
2023-03-07 02:02:07 -03:00

31 lines
760 B
TypeScript

import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AnalyticsVideo extends YTNode {
static type = 'AnalyticsVideo';
title: string;
metadata: {
views: string;
published: string;
thumbnails: Thumbnail[];
duration: string;
is_short: boolean;
};
constructor(data: RawNode) {
super();
this.title = data.videoTitle;
this.metadata = {
views: data.videoDescription.split('·')[0].trim(),
published: data.videoDescription.split('·')[1].trim(),
thumbnails: Thumbnail.fromResponse(data.thumbnailDetails),
duration: data.formattedLength,
is_short: data.isShort
};
}
}
export default AnalyticsVideo;