SuspiciousLookingOwl / youtubei

Get Youtube data such as videos, playlists, channels, video information & comments, related videos, up next video, and more!
https://suspiciouslookingowl.github.io/youtubei
MIT License
220 stars 50 forks source link

CommentReplies is always empty #114

Open ShinyRa opened 3 weeks ago

ShinyRa commented 3 weeks ago

Bug description Fetching replies of a comment using the .next() function on always returns an empty array.

To Reproduce

import { Client } from "youtubei";

const youtube = new Client();

const run = async () => {
    const video = await youtube.getVideo("xA-BxSKV0aU")
    const comments = await video.comments.next()
    console.log(comments[0].replyCount) // 49, indicating that 49 replies could be fetched

    const replies = await comments[0].replies.next()
    console.log(replies) // empty array
}

run()

Output image

Expected behavior When retrieving replies of a youtube comment using comment.replies.next(), with comment.replyCount being higher than 0. I expect the replies array to be populated with correctly fetched replies.

ShinyRa commented 3 weeks ago

After some minor debugging, I found that an instance of CommentReplies gets created while getting comments, but calling const replies = await comments[0].replies.next() does not trigger the fetch() method in CommentReplies.

By manually calling the fetch method using const replies = await comments[0].replies.fetch(), I get an error (see attached screenshot), but granted this is not the intended way of retrieving replies.

Maybe I'm looking in the wrong places and retrieving comment replies is done differently, if that is the case please let me know!

image