-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Parser): Add
ClipSection
(#532)
* feat: add `ClipSection` * fix: Update src/parser/classes/ClipCreation.ts --------- Co-authored-by: absidue <[email protected]>
- Loading branch information
1 parent
e021395
commit 9007b65
Showing
7 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
import type { RawNode } from '../types/index.js'; | ||
|
||
export default class ClipAdState extends YTNode { | ||
static type = 'ClipAdState'; | ||
|
||
title: Text; | ||
body: Text; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.body = new Text(data.body); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import Thumbnail from './misc/Thumbnail.js'; | ||
import Button from './Button.js'; | ||
import ClipCreationTextInput from './ClipCreationTextInput.js'; | ||
import ClipCreationScrubber from './ClipCreationScrubber.js'; | ||
import ClipAdState from './ClipAdState.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
import { Parser } from '../index.js'; | ||
|
||
import type { RawNode } from '../types/index.js'; | ||
|
||
export default class ClipCreation extends YTNode { | ||
static type = 'ClipCreation'; | ||
|
||
user_avatar: Thumbnail[]; | ||
title_input: ClipCreationTextInput | null; | ||
scrubber: ClipCreationScrubber | null; | ||
save_button: Button | null; | ||
display_name: Text; | ||
publicity_label: string; | ||
cancel_button: Button | null; | ||
ad_state_overlay: ClipAdState | null; | ||
external_video_id: string; | ||
publicity_label_icon: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.user_avatar = Thumbnail.fromResponse(data.userAvatar); | ||
this.title_input = Parser.parseItem(data.titleInput, [ ClipCreationTextInput ]); | ||
this.scrubber = Parser.parseItem(data.scrubber, [ ClipCreationScrubber ]); | ||
this.save_button = Parser.parseItem(data.saveButton, [ Button ]); | ||
this.display_name = new Text(data.displayName); | ||
this.publicity_label = data.publicityLabel; | ||
this.cancel_button = Parser.parseItem(data.cancelButton, [ Button ]); | ||
this.ad_state_overlay = Parser.parseItem(data.adStateOverlay, [ ClipAdState ]); | ||
this.external_video_id = data.externalVideoId; | ||
this.publicity_label_icon = data.publicityLabelIcon; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { YTNode } from '../helpers.js'; | ||
|
||
import type { RawNode } from '../types/index.js'; | ||
|
||
export default class ClipCreationScrubber extends YTNode { | ||
static type = 'ClipCreationScrubber'; | ||
|
||
length_template: string; | ||
max_length_ms: number; | ||
min_length_ms: number; | ||
default_length_ms: number; | ||
window_size_ms: number; | ||
start_label?: string; | ||
end_label?: string; | ||
duration_label?: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.length_template = data.lengthTemplate; | ||
this.max_length_ms = data.maxLengthMs; | ||
this.min_length_ms = data.minLengthMs; | ||
this.default_length_ms = data.defaultLengthMs; | ||
this.window_size_ms = data.windowSizeMs; | ||
this.start_label = data.startAccessibility?.accessibilityData?.label; | ||
this.end_label = data.endAccessibility?.accessibilityData?.label; | ||
this.duration_label = data.durationAccessibility?.accessibilityData?.label; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
import type { RawNode } from '../types/index.js'; | ||
|
||
export default class ClipCreationTextInput extends YTNode { | ||
static type = 'ClipCreationTextInput'; | ||
|
||
placeholder_text: Text; | ||
max_character_limit: number; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.placeholder_text = new Text(data.placeholderText); | ||
this.max_character_limit = data.maxCharacterLimit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { ObservedArray } from '../helpers.js'; | ||
import { YTNode } from '../helpers.js'; | ||
|
||
import ClipCreation from './ClipCreation.js'; | ||
|
||
import { Parser } from '../index.js'; | ||
|
||
import type { RawNode } from '../types/index.js'; | ||
|
||
export default class ClipSection extends YTNode { | ||
static type = 'ClipSection'; | ||
|
||
contents: ObservedArray<ClipCreation> | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.contents = Parser.parse(data.contents, true, [ ClipCreation ]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters