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

# Youtube

**YouTubeTools** 在提供视频 URL 后，可使 Agent 访问 YouTube 视频的字幕和元数据。

## 先决条件

以下示例需要 `youtube_transcript_api` 库。

```shell theme={null}
pip install -U youtube_transcript_api
```

## 示例

下面的 Agent 将提供一个 YouTube 视频的摘要。

```python cookbook/tools/youtube_tools.py theme={null}
from agno.agent import Agent
from agno.tools.youtube import YouTubeTools

agent = Agent(
    tools=[YouTubeTools()],
    show_tool_calls=True,
    description="你是一个 YouTube Agent。获取一个 YouTube 视频的字幕并回答问题。",
)

agent.print_response("总结一下这个视频 https://www.youtube.com/watch?v=Iv9dewmcFbs&t", markdown=True)
```

## Toolkit 参数

| 参数                   | 类型          | 默认值    | 描述                   |
| -------------------- | ----------- | ------ | -------------------- |
| `get_video_captions` | `bool`      | `True` | 启用检索视频字幕的功能。         |
| `get_video_data`     | `bool`      | `True` | 启用检索视频元数据及其他相关数据的功能。 |
| `languages`          | `List[str]` | -      | 指定要检索数据的语言列表，如果适用。   |

## Toolkit 函数

| 函数                           | 描述                    |
| ---------------------------- | --------------------- |
| `get_youtube_video_captions` | 此函数检索 YouTube 视频的字幕。  |
| `get_youtube_video_data`     | 此函数检索 YouTube 视频的元数据。 |

## 开发者资源

* 查看 [工具](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/youtube.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/youtube_tools.py)
