Youtube
YouTubeTools enable an Agent to access captions and metadata of YouTube videos, when provided with a video URL.
Prerequisites
The following example requires the youtube_transcript_api library.
1uv pip install -U youtube_transcript_apiExample
The following agent will provide a summary of a YouTube video.
1from kern.agent import Agent2from kern.tools.youtube import YouTubeTools34agent = Agent(5 tools=[YouTubeTools()],6 description="You are a YouTube agent. Obtain the captions of a YouTube video and answer questions.",7)89agent.print_response("Summarize this video https://www.youtube.com/watch?v=Iv9dewmcFbs&t", markdown=True)Toolkit Params
| 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. |
enable_get_video_captions | bool | True | Enable the get_video_captions functionality. |
enable_get_video_data | bool | True | Enable the get_video_data functionality. |
enable_get_video_timestamps | bool | True | Enable the get_video_timestamps functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| 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. |
get_youtube_video_timestamps | This function retrieves the timestamps of a YouTube video. |
Developer Resources
- View Tools