From a45273fec498df87eecd364ffb708c9f787793d5 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Sat, 28 Oct 2023 13:17:26 -0300 Subject: [PATCH] feat(parser): Add `PlayerOverflow` and `PlayerControlsOverlay` --- src/parser/classes/PlayerControlsOverlay.ts | 14 ++++++++++++++ src/parser/classes/PlayerOverflow.ts | 16 ++++++++++++++++ src/parser/nodes.ts | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 src/parser/classes/PlayerControlsOverlay.ts create mode 100644 src/parser/classes/PlayerOverflow.ts diff --git a/src/parser/classes/PlayerControlsOverlay.ts b/src/parser/classes/PlayerControlsOverlay.ts new file mode 100644 index 000000000..9a860e875 --- /dev/null +++ b/src/parser/classes/PlayerControlsOverlay.ts @@ -0,0 +1,14 @@ +import { YTNode } from '../helpers.js'; +import { Parser, type RawNode } from '../index.js'; +import PlayerOverflow from './PlayerOverflow.js'; + +export default class PlayerControlsOverlay extends YTNode { + static type = 'PlayerControlsOverlay'; + + overflow: PlayerOverflow | null; + + constructor(data: RawNode) { + super(); + this.overflow = Parser.parseItem(data.overflow, PlayerOverflow); + } +} \ No newline at end of file diff --git a/src/parser/classes/PlayerOverflow.ts b/src/parser/classes/PlayerOverflow.ts new file mode 100644 index 000000000..475a73407 --- /dev/null +++ b/src/parser/classes/PlayerOverflow.ts @@ -0,0 +1,16 @@ +import { YTNode } from '../helpers.js'; +import type { RawNode } from '../index.js'; +import NavigationEndpoint from './NavigationEndpoint.js'; + +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; + } +} \ No newline at end of file diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index 0ac65c620..ac04857ba 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -252,11 +252,13 @@ export { default as PageHeaderView } from './classes/PageHeaderView.js'; export { default as PageIntroduction } from './classes/PageIntroduction.js'; export { default as PlayerAnnotationsExpanded } from './classes/PlayerAnnotationsExpanded.js'; export { default as PlayerCaptionsTracklist } from './classes/PlayerCaptionsTracklist.js'; +export { default as PlayerControlsOverlay } from './classes/PlayerControlsOverlay.js'; export { default as PlayerErrorMessage } from './classes/PlayerErrorMessage.js'; export { default as PlayerLegacyDesktopYpcOffer } from './classes/PlayerLegacyDesktopYpcOffer.js'; export { default as PlayerLegacyDesktopYpcTrailer } from './classes/PlayerLegacyDesktopYpcTrailer.js'; export { default as PlayerLiveStoryboardSpec } from './classes/PlayerLiveStoryboardSpec.js'; export { default as PlayerMicroformat } from './classes/PlayerMicroformat.js'; +export { default as PlayerOverflow } from './classes/PlayerOverflow.js'; export { default as PlayerOverlay } from './classes/PlayerOverlay.js'; export { default as PlayerOverlayAutoplay } from './classes/PlayerOverlayAutoplay.js'; export { default as PlayerStoryboardSpec } from './classes/PlayerStoryboardSpec.js';