mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-14 01:52:11 +00:00
* tests: improve coverage * refactor: clean up nodes * chore: lint * feat(parser): ignore `BrandVideoShelf` Seems to be used for ads. * feat(parser): ignore `BrandVideoSingleton` too
30 lines
709 B
TypeScript
30 lines
709 B
TypeScript
import { YTNode } from '../helpers.js';
|
|
import type { RawNode } from '../index.js';
|
|
import NavigationEndpoint from './NavigationEndpoint.js';
|
|
|
|
export default class LikeButton extends YTNode {
|
|
static type = 'LikeButton';
|
|
|
|
target: {
|
|
video_id: string;
|
|
};
|
|
|
|
like_status: string;
|
|
likes_allowed: string;
|
|
endpoints?: NavigationEndpoint[];
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
|
|
this.target = {
|
|
video_id: data.target.videoId
|
|
};
|
|
|
|
this.like_status = data.likeStatus;
|
|
this.likes_allowed = data.likesAllowed;
|
|
|
|
if (Reflect.has(data, 'serviceEndpoints')) {
|
|
this.endpoints = data.serviceEndpoints.map((endpoint: RawNode) => new NavigationEndpoint(endpoint));
|
|
}
|
|
}
|
|
} |