Skip to main content

YouTube transcripts

This covers how to load youtube transcript into LangChain documents.


You'll need to install the youtube-transcript package and youtubei.js to extract metadata:

npm install youtube-transcript youtubei.js


You need to specify a link to the video in the url. You can also specify language in ISO 639-1 and addVideoInfo flag.

import { YoutubeLoader } from "@langchain/community/document_loaders/web/youtube";

const loader = YoutubeLoader.createFromUrl("", {
language: "en",
addVideoInfo: true,

const docs = await loader.load();


API Reference:

  • YoutubeLoader from @langchain/community/document_loaders/web/youtube

Was this page helpful?

You can also leave detailed feedback on GitHub.