#!/usr/bin/env node
// Test the specific video provided by the user
const { YoutubeTranscript } = require('youtube-transcript');
async function testUserVideo() {
console.log('š§ Testing user-provided video...');
const videoId = 'F_RyElT_gJk'; // Extracted from https://youtu.be/F_RyElT_gJk?si=fejif3PqzMHbUA2Z
const videoUrl = 'https://www.youtube.com/watch?v=' + videoId;
console.log('Video URL:', videoUrl);
console.log('Video ID:', videoId);
try {
console.log('ā³ Fetching transcript...');
const transcript = await YoutubeTranscript.fetchTranscript(videoId);
console.log('ā
SUCCESS! Transcript available');
console.log('Segments found:', transcript.length);
if (transcript.length > 0) {
console.log('\nš First few segments:');
transcript.slice(0, 5).forEach((segment, index) => {
console.log(`${index + 1}. [${(segment.offset / 1000).toFixed(1)}s] ${segment.text}`);
});
console.log('\nš Transcript info:');
console.log('- Total segments:', transcript.length);
console.log('- Duration:', (transcript[transcript.length - 1].offset / 1000 / 60).toFixed(1), 'minutes');
console.log('- First segment starts at:', (transcript[0].offset / 1000).toFixed(1), 'seconds');
}
} catch (error) {
console.log('ā FAILED:', error.message);
if (error.message.includes('Transcript is disabled')) {
console.log('\nš” This means:');
console.log('- The video creator has disabled transcripts/captions');
console.log('- No auto-generated captions are available');
console.log('- This is a normal YouTube setting, not a bug in our code');
}
}
}
testUserVideo().catch(console.error);