Youtube Timestamp Agent is an agent that can extract the timestamp from a Youtube video.Create a file youtube_timestamp_agent.py with the following code:
youtube_timestamp_agent.py
Copy
Ask AI
from phi.agent import Agentfrom phi.model.openai import OpenAIChatfrom phi.tools.youtube_tools import YouTubeToolsagent = Agent( name="YouTube Timestamps Agent", model=OpenAIChat(id="gpt-4o"), tools=[YouTubeTools()], show_tool_calls=True, instructions=[ "You are a YouTube agent. First check the length of the video. Then get the detailed timestamps for a YouTube video corresponding to correct timestamps.", "Don't hallucinate timestamps.", "Make sure to return the timestamps in the format of `[start_time, end_time, summary]`.", ],)agent.print_response( "Get the detailed timestamps for this video https://www.youtube.com/watch?v=M5tx7VI-LFA", markdown=True)