diff --git a/src/parser/classes/Quiz.ts b/src/parser/classes/Quiz.ts new file mode 100644 index 00000000..72a69fbe --- /dev/null +++ b/src/parser/classes/Quiz.ts @@ -0,0 +1,25 @@ +import { YTNode } from '../helpers.js'; +import type { RawNode } from '../index.js'; +import Text from './misc/Text.js'; + +export default class Quiz extends YTNode { + static type = 'Quiz'; + + choices: { + text: Text; + is_correct: boolean; + }[]; + + total_votes: Text; + + constructor(data: RawNode) { + super(); + + this.choices = data.choices.map((choice: RawNode) => ({ + text: new Text(choice.text), + is_correct: choice.isCorrect + })); + + this.total_votes = new Text(data.totalVotes); + } +} \ No newline at end of file diff --git a/src/parser/nodes.ts b/src/parser/nodes.ts index 56e1bc1d..d13c67f2 100644 --- a/src/parser/nodes.ts +++ b/src/parser/nodes.ts @@ -265,6 +265,7 @@ export { default as ProfileColumn } from './classes/ProfileColumn.js'; export { default as ProfileColumnStats } from './classes/ProfileColumnStats.js'; export { default as ProfileColumnStatsEntry } from './classes/ProfileColumnStatsEntry.js'; export { default as ProfileColumnUserInfo } from './classes/ProfileColumnUserInfo.js'; +export { default as Quiz } from './classes/Quiz.js'; export { default as RecognitionShelf } from './classes/RecognitionShelf.js'; export { default as ReelItem } from './classes/ReelItem.js'; export { default as ReelShelf } from './classes/ReelShelf.js';