Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-mdrxyo-1777658790-7be347c.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This covers how to load YouTube transcripts into LangChain documents.

Setup

You’ll need to install the youtubei.js to extract metadata:
npm
npm install @langchain/community @langchain/core youtubei.js

Usage

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("https://youtu.be/bZQun8Y4L2A", {
  language: "en",
  addVideoInfo: true,
});

const docs = await loader.load();

console.log(docs);