mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-27 00:29:16 +00:00
chore: v7.0.0 release
This commit is contained in:
14
deno/src/parser/classes/PlayerControlsOverlay.ts
Normal file
14
deno/src/parser/classes/PlayerControlsOverlay.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { YTNode } from '../helpers.ts';
|
||||
import { Parser, type RawNode } from '../index.ts';
|
||||
import PlayerOverflow from './PlayerOverflow.ts';
|
||||
|
||||
export default class PlayerControlsOverlay extends YTNode {
|
||||
static type = 'PlayerControlsOverlay';
|
||||
|
||||
overflow: PlayerOverflow | null;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.overflow = Parser.parseItem(data.overflow, PlayerOverflow);
|
||||
}
|
||||
}
|
||||
16
deno/src/parser/classes/PlayerOverflow.ts
Normal file
16
deno/src/parser/classes/PlayerOverflow.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { YTNode } from '../helpers.ts';
|
||||
import type { RawNode } from '../index.ts';
|
||||
import NavigationEndpoint from './NavigationEndpoint.ts';
|
||||
|
||||
export default class PlayerOverflow extends YTNode {
|
||||
static type = 'PlayerOverflow';
|
||||
|
||||
endpoint: NavigationEndpoint;
|
||||
enable_listen_first: boolean;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.endpoint = new NavigationEndpoint(data.endpoint);
|
||||
this.enable_listen_first = data.enableListenFirst;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ export default class ToggleButton extends YTNode {
|
||||
this.toggled_tooltip = data.toggledTooltip;
|
||||
this.is_toggled = data.isToggled;
|
||||
this.is_disabled = data.isDisabled;
|
||||
this.icon_type = data.defaultIcon.iconType;
|
||||
this.icon_type = data.defaultIcon?.iconType;
|
||||
|
||||
const acc_label =
|
||||
data?.defaultText?.accessibility?.accessibilityData?.label ||
|
||||
|
||||
@@ -7,6 +7,8 @@ export default class UpdateViewershipAction extends YTNode {
|
||||
|
||||
view_count: Text;
|
||||
extra_short_view_count: Text;
|
||||
original_view_count: Number;
|
||||
unlabeled_view_count_value: Text;
|
||||
is_live: boolean;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
@@ -14,6 +16,8 @@ export default class UpdateViewershipAction extends YTNode {
|
||||
const view_count_renderer = data.viewCount.videoViewCountRenderer;
|
||||
this.view_count = new Text(view_count_renderer.viewCount);
|
||||
this.extra_short_view_count = new Text(view_count_renderer.extraShortViewCount);
|
||||
this.original_view_count = parseInt(view_count_renderer.originalViewCount);
|
||||
this.unlabeled_view_count_value = new Text(view_count_renderer.unlabeledViewCountValue);
|
||||
this.is_live = view_count_renderer.isLive;
|
||||
}
|
||||
}
|
||||
22
deno/src/parser/classes/ytkids/KidsBlocklistPicker.ts
Normal file
22
deno/src/parser/classes/ytkids/KidsBlocklistPicker.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import Text from '../misc/Text.ts';
|
||||
import { YTNode } from '../../helpers.ts';
|
||||
import Button from '../Button.ts';
|
||||
import Parser, { type RawNode } from '../../index.ts';
|
||||
import KidsBlocklistPickerItem from './KidsBlocklistPickerItem.ts';
|
||||
|
||||
export default class KidsBlocklistPicker extends YTNode {
|
||||
static type = 'KidsBlocklistPicker';
|
||||
|
||||
title: Text;
|
||||
child_rows: KidsBlocklistPickerItem[] | null;
|
||||
done_button: Button | null;
|
||||
successful_toast_action_message: Text;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.title = new Text(data.title);
|
||||
this.child_rows = Parser.parse(data.childRows, true, [ KidsBlocklistPickerItem ]);
|
||||
this.done_button = Parser.parseItem(data.doneButton, [ Button ]);
|
||||
this.successful_toast_action_message = new Text(data.successfulToastActionMessage);
|
||||
}
|
||||
}
|
||||
49
deno/src/parser/classes/ytkids/KidsBlocklistPickerItem.ts
Normal file
49
deno/src/parser/classes/ytkids/KidsBlocklistPickerItem.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import Text from '../misc/Text.ts';
|
||||
import { YTNode } from '../../helpers.ts';
|
||||
import Parser, { type RawNode } from '../../index.ts';
|
||||
import ToggleButton from '../ToggleButton.ts';
|
||||
import Thumbnail from '../misc/Thumbnail.ts';
|
||||
import type Actions from '../../../core/Actions.ts';
|
||||
import { InnertubeError } from '../../../utils/Utils.ts';
|
||||
import { type ApiResponse } from '../../../core/Actions.ts';
|
||||
|
||||
export default class KidsBlocklistPickerItem extends YTNode {
|
||||
static type = 'KidsBlocklistPickerItem';
|
||||
|
||||
#actions?: Actions;
|
||||
|
||||
child_display_name: Text;
|
||||
child_account_description: Text;
|
||||
avatar: Thumbnail[];
|
||||
block_button: ToggleButton | null;
|
||||
blocked_entity_key: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.child_display_name = new Text(data.childDisplayName);
|
||||
this.child_account_description = new Text(data.childAccountDescription);
|
||||
this.avatar = Thumbnail.fromResponse(data.avatar);
|
||||
this.block_button = Parser.parseItem(data.blockButton, [ ToggleButton ]);
|
||||
this.blocked_entity_key = data.blockedEntityKey;
|
||||
}
|
||||
|
||||
async blockChannel(): Promise<ApiResponse> {
|
||||
if (!this.#actions)
|
||||
throw new InnertubeError('An active caller must be provide to perform this operation.');
|
||||
|
||||
const button = this.block_button;
|
||||
|
||||
if (!button)
|
||||
throw new InnertubeError('Block button was not found.', { child_display_name: this.child_display_name });
|
||||
|
||||
if (button.is_toggled)
|
||||
throw new InnertubeError('This channel is already blocked.', { child_display_name: this.child_display_name });
|
||||
|
||||
const response = await button.endpoint.call(this.#actions, { parse: false });
|
||||
return response;
|
||||
}
|
||||
|
||||
setActions(actions: Actions | undefined) {
|
||||
this.#actions = actions;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user