mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-20 13:01:31 +00:00
* feat(Player.ts): append `cver` to deciphered URLs * refactor(Actions.ts): remove redundant `getVideoInfo` function This is leftover code from previous versions. It had many problems and it is no longer required. * fix(Kids.ts): remove unneeded `await` keywords * dev: add more endpoints * chore: update deps * refactor: separate endpoints into files * dev: improve types * dev: add more endpoints * refactor: put clients in a separate directory inside `core` * chore: lint * refactor: move mixins and managers to separate folders * chore: fix tests * dev: add `CreateVideoEndpoint` * chore: clean up * chore: lint * chore: add some comments * chore: remove unnecessary test * dev: add `playlist/CreateEndpoint` * dev: add `playlist/DeleteEndpoint` * dev: add `browse/EditPlaylistEndpoint` * fix(parser): add a few checks to avoid parsing errors
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { YTNode, observe, type ObservedArray } from '../helpers.js';
|
|
import type { RawNode } from '../index.js';
|
|
import Parser from '../index.js';
|
|
import Chapter from './Chapter.js';
|
|
import Heatmap from './Heatmap.js';
|
|
|
|
export 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 (Reflect.has(data, 'value')) {
|
|
if (Reflect.has(data.value, 'heatmap')) {
|
|
this.value.heatmap = Parser.parseItem(data.value.heatmap, Heatmap);
|
|
}
|
|
|
|
if (Reflect.has(data.value, 'chapters')) {
|
|
this.value.chapters = Parser.parseArray(data.value.chapters, Chapter);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export default 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]: RawNode
|
|
}
|
|
}) => new Marker(marker)) || []);
|
|
}
|
|
} |