main
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-05-06 10:48:07 +02:00
parent 2d6f068363
commit a40619ef33
44 changed files with 4295 additions and 126 deletions
+34
View File
@@ -0,0 +1,34 @@
const { Innertube } = require('youtubei.js');
async function test() {
const youtube = await Innertube.create({ lang: 'tr', location: 'TR' });
const videoId = 'ix8cLltPCCE';
console.log('Fetching comments for', videoId);
const commentThread = await youtube.getComments(videoId);
let comments = [];
let currentThread = commentThread;
let pages = 0;
while (currentThread) {
if (currentThread.contents) {
for (const thread of currentThread.contents) {
if (thread.comment?.content?.text) {
comments.push(thread.comment.content.text);
}
}
}
if (currentThread.has_continuation && pages < 50) {
pages++;
currentThread = await currentThread.getContinuation();
console.log('Page', pages, 'Total so far:', comments.length);
} else {
break;
}
}
console.log('Total comments fetched:', comments.length);
}
test().catch(console.error);