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

Example

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

cookbook/tools/youtube_tools.py
from phi.assistant import Assistant
from phi.tools.youtube_tools import YouTubeTools

assistant = Assistant(
    tools=[YouTubeTools()],
    show_tool_calls=True,
    description="You are a YouTube assistant. Obtain the captions of a YouTube video and answer questions.",
    debug_mode=True,
)
assistant.print_response('Summarize this video https://www.youtube.com/watch?v=Iv9dewmcFbs&t', markdown=True)

Toolkit Params

get_video_captions
bool
default: "True"

Enables the functionality to retrieve video captions.

get_video_data
bool
default: "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.

Toolkit Functions

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.