> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube 转录稿集成

> 使用 LangChain JavaScript 与 YouTube 转录稿文档加载器集成。

本节介绍如何将 YouTube 转录稿加载到 LangChain 文档中。

## 设置

您需要安装 [youtubei.js](https://www.npmjs.com/package/youtubei.js) 以提取元数据：

```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
npm install @langchain/community @langchain/core youtubei.js
```

## 用法

您需要在 `url` 中指定视频链接。您还可以指定 [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) 格式的 `language` 和 `addVideoInfo` 标志。

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
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);
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs) 到 Claude、VSCode 等，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/web_loaders/youtube.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
