A simple JavaScript API which allows you to get the transcript/subtitles for a given YouTube video. It is inspired by a Python-based project YouTube Transcript API.
npm install yt-transcript
import { YtTranscript } from 'yt-transcript';
const ytTranscript = new YtTranscript({videoId: 'dQw4w9WgXcQ'});
ytTranscript.listAllTranscripts().then((transcript) => {
console.log(transcript);
});
ytTranscript.getTranscript().then((transcript) => {
console.log(transcript);
});
This package uses the undocumented YouTube API to fetch the transcript. It is not guaranteed to work in the future. Use at your own risk. I'm not responsible for any damage caused by using this package.
MIT License