mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-16 19:12:24 +00:00
* refactor: move common info into MediaInfo * refactor: better inference on Memo * refactor: improved typesafety in parser methods * refactor: remove PlaylistAuthor in favor of Author * refactor: cleanup live chat parsers - Replace non standard author type with Author class - Remove redundant code * fix: new errors due to changes * fix: pass actions to FormatUtils#toDash * refactor!: merge NavigatableText and Text into single class
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import Parser from '../index.js';
|
|
import Chapter from './Chapter.js';
|
|
import Heatmap from './Heatmap.js';
|
|
import type { RawNode } from '../index.js';
|
|
|
|
import { observe, ObservedArray, YTNode } from '../helpers.js';
|
|
|
|
class Marker extends YTNode {
|
|
static type = 'Marker';
|
|
|
|
marker_key: string;
|
|
value: {
|
|
heatmap?: Heatmap | null;
|
|
chapters?: Chapter[];
|
|
};
|
|
|
|
constructor (data: RawNode) {
|
|
super();
|
|
this.marker_key = data.key;
|
|
|
|
this.value = {};
|
|
|
|
if (data.value.heatmap) {
|
|
this.value.heatmap = Parser.parseItem(data.value.heatmap, Heatmap);
|
|
}
|
|
|
|
if (data.value.chapters) {
|
|
this.value.chapters = Parser.parseArray(data.value.chapters, Chapter);
|
|
}
|
|
}
|
|
}
|
|
|
|
class MultiMarkersPlayerBar extends YTNode {
|
|
static type = 'MultiMarkersPlayerBar';
|
|
|
|
markers_map: ObservedArray<Marker>;
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
this.markers_map = observe(data.markersMap?.map((marker: {
|
|
key: string;
|
|
value: { [key: string ]: any
|
|
}}) => new Marker(marker)) || []);
|
|
}
|
|
}
|
|
|
|
export { Marker };
|
|
export default MultiMarkersPlayerBar; |