> For the complete documentation index, see [llms.txt](https://docs.projectbit.ca/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.projectbit.ca/documentation/tools/yfinance.md).

# Yfinance

**YouTubeTools** enable an Agent to access captions and metadata of YouTube videos, when provided with a video URL.

### [​](https://docs.phidata.com/tools/youtube#prerequisites)Prerequisites <a href="#prerequisites" id="prerequisites"></a>

The following example requires the `youtube_transcript_api` library.

```shell
pip install -U youtube_transcript_api
```

### [​](https://docs.phidata.com/tools/youtube#example)Example <a href="#example" id="example"></a>

The following agent will provide a summary of a YouTube video.

cookbook/tools/youtube\_tools.py

```python
from bitca.agent import Agent
from bitca.tools.youtube_tools import YouTubeTools

agent = Agent(
    tools=[YouTubeTools()],
    show_tool_calls=True,
    description="You are a YouTube agent. Obtain the captions of a YouTube video and answer questions.",
)

agent.print_response("Summarize this video https://www.youtube.com/watch?v=Iv9dewmcFbs&t", markdown=True)
```

### [​](https://docs.phidata.com/tools/youtube#toolkit-params)Toolkit Params <a href="#toolkit-params" id="toolkit-params"></a>

| Param                | Type        | Default | Description                                                                        |
| -------------------- | ----------- | ------- | ---------------------------------------------------------------------------------- |
| `get_video_captions` | `bool`      | `True`  | Enables the functionality to retrieve video captions.                              |
| `get_video_data`     | `bool`      | `True`  | Enables the functionality to retrieve video metadata and other related data.       |
| `languages`          | `List[str]` | -       | Specifies the list of languages for which data should be retrieved, if applicable. |

### [​](https://docs.phidata.com/tools/youtube#toolkit-functions)Toolkit Functions <a href="#toolkit-functions" id="toolkit-functions"></a>

| Function                     | Description                                              |
| ---------------------------- | -------------------------------------------------------- |
| `get_youtube_video_captions` | This function retrieves the captions of a YouTube video. |
| `get_youtube_video_data`     | This function retrieves the metadata of a YouTube video. |
