Update tools.py
Browse files
tools.py
CHANGED
|
@@ -4,7 +4,7 @@ from langchain_core.messages import HumanMessage
|
|
| 4 |
from langchain.tools import tool
|
| 5 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 6 |
from langchain_community.document_loaders import WikipediaLoader, ArxivLoader
|
| 7 |
-
import yt_dlp
|
| 8 |
import ffmpeg
|
| 9 |
|
| 10 |
|
|
@@ -208,27 +208,27 @@ class TranscribeAudio:
|
|
| 208 |
return ""
|
| 209 |
|
| 210 |
|
| 211 |
-
@tool
|
| 212 |
-
def download_youtube_video(youtube_url: str, output_path: str) -> str:
|
| 213 |
-
|
| 214 |
-
|
| 215 |
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
|
| 233 |
|
| 234 |
@tool
|
|
|
|
| 4 |
from langchain.tools import tool
|
| 5 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 6 |
from langchain_community.document_loaders import WikipediaLoader, ArxivLoader
|
| 7 |
+
# import yt_dlp
|
| 8 |
import ffmpeg
|
| 9 |
|
| 10 |
|
|
|
|
| 208 |
return ""
|
| 209 |
|
| 210 |
|
| 211 |
+
# @tool
|
| 212 |
+
# def download_youtube_video(youtube_url: str, output_path: str) -> str:
|
| 213 |
+
# """
|
| 214 |
+
# Download a YouTube video as an MP4 file.
|
| 215 |
|
| 216 |
+
# Args:
|
| 217 |
+
# youtube_url: The YouTube video URL.
|
| 218 |
+
# output_path: Desired output path for the downloaded MP4 file.
|
| 219 |
+
|
| 220 |
+
# Returns:
|
| 221 |
+
# Path to the saved video file.
|
| 222 |
+
# """
|
| 223 |
+
# ydl_opts = {
|
| 224 |
+
# 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best',
|
| 225 |
+
# 'outtmpl': output_path,
|
| 226 |
+
# 'merge_output_format': 'mp4',
|
| 227 |
+
# 'quiet': True,
|
| 228 |
+
# }
|
| 229 |
+
# with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 230 |
+
# ydl.download([youtube_url])
|
| 231 |
+
# return output_path
|
| 232 |
|
| 233 |
|
| 234 |
@tool
|