File size: 409 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { YoutubeTranscript } from 'youtube-transcript';

export function fetchAndLogTranscript(videoIdOrURL) {
    return YoutubeTranscript.fetchTranscript(videoIdOrURL)
        .then(transcript => {
            console.log(transcript);
            return transcript; 
        })
        .catch(error => {
            console.error('Error fetching transcript:', error);
            throw error;
        });
}