#!/usr/bin/env node
// Test with a video that should have transcripts
const { YoutubeTranscript } = require('youtube-transcript');
async function testWorkingVideo() {
console.log('🔧 Testing youtube-transcript with multiple videos...');
// Try videos that should have auto-generated captions
const testVideos = [
'F_RyElT_gJk', // User provided video
'9bZkp7q19f0', // Popular educational video
'kJQP7kiw5Fk', // Educational content
'WPmM4B6cCdA', // Popular tech content
'LDU_Txk06tM', // Educational channel
'dQw4w9WgXcQ' // Classic video (backup)
];
for (const videoId of testVideos) {
try {
console.log(`⏳ Fetching transcript for video: ${videoId}`);
const transcript = await YoutubeTranscript.fetchTranscript(videoId);
console.log('✅ Success! Got transcript with', transcript.length, 'segments');
if (transcript.length > 0) {
console.log('First segment:', transcript[0]);
console.log('Video URL: https://www.youtube.com/watch?v=' + videoId);
return; // Found working video, exit
}
} catch (error) {
console.log(`❌ Video ${videoId}:`, error.message);
continue;
}
}
console.log('❌ No videos found with available transcripts');
}
testWorkingVideo().catch(console.error);