Spaces:
Sleeping
Sleeping
DiegoSanC
refactor: :recycle: Move langgraph solution to langgraph folder as it is not working properly
d4598ef
from langchain_core.tools import tool | |
from youtube_transcript_api import YouTubeTranscriptApi | |
def youtube_transcript(url: str) -> str: | |
""" | |
Get transcript of YouTube video. | |
Args: | |
url: YouTube video url in "" | |
""" | |
video_id = url.partition("https://www.youtube.com/watch?v=")[2] | |
transcript = YouTubeTranscriptApi.get_transcript(video_id) | |
transcript_text = " ".join([item["text"] for item in transcript]) | |
return {"youtube_transcript": transcript_text} |