mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 15:52:13 +00:00
feat(CommentsView): parse voice_reply_transcript (#981)
* Parse the VoiceReplyContainer instead of just parsing the text
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { Parser } from '../../index.js';
|
||||
import { YTNode } from '../../helpers.js';
|
||||
import NavigationEndpoint from '../NavigationEndpoint.js';
|
||||
import Author from '../misc/Author.js';
|
||||
import Text from '../misc/Text.js';
|
||||
import CommentReplyDialog from './CommentReplyDialog.js';
|
||||
import VoiceReplyContainerView from './VoiceReplyContainerView.js';
|
||||
import { InnertubeError } from '../../../utils/Utils.js';
|
||||
import * as ProtoUtils from '../../../utils/ProtoUtils.js';
|
||||
|
||||
@@ -63,6 +65,8 @@ export default class CommentView extends YTNode {
|
||||
public is_disliked?: boolean;
|
||||
public is_hearted?: boolean;
|
||||
|
||||
public voice_reply_container?: VoiceReplyContainerView | null;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
|
||||
@@ -78,7 +82,7 @@ export default class CommentView extends YTNode {
|
||||
};
|
||||
}
|
||||
|
||||
applyMutations(comment?: RawNode, toolbar_state?: RawNode, toolbar_surface?: RawNode) {
|
||||
applyMutations(comment?: RawNode, toolbar_state?: RawNode, toolbar_surface?: RawNode, comment_surface?: RawNode) {
|
||||
if (comment) {
|
||||
this.content = Text.fromAttributed(comment.properties.content);
|
||||
this.published_time = comment.properties.publishedTime;
|
||||
@@ -129,6 +133,12 @@ export default class CommentView extends YTNode {
|
||||
this.reply_command = new NavigationEndpoint(toolbar_surface.replyCommand);
|
||||
}
|
||||
}
|
||||
|
||||
if (comment_surface) {
|
||||
if ('voiceReplyContainerViewModel' in comment_surface) {
|
||||
this.voice_reply_container = Parser.parseItem(comment_surface.voiceReplyContainerViewModel, VoiceReplyContainerView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user