Skip to content

Agent Zero AI framework

yt download instrument example

frdelff6c196d155d
diff --git a/initialize.py b/initialize.py
index 3c7316d12..b741eae90 100644
--- a/initialize.py
+++ b/initialize.py
@@ -30,7 +30,7 @@ def initialize():
chat_model = chat_llm,
utility_model = utility_llm,
embeddings_model = embedding_llm,
- # prompts_subdir = "",
+ # prompts_subdir = "default",
# memory_subdir = "",
knowledge_subdirs = ["default","custom"],
auto_memory_count = 0,
diff --git a/instruments/default/yt_download/yt_download.md b/instruments/default/yt_download/yt_download.md
index b469527dd..25f09ffd6 100644
--- a/instruments/default/yt_download/yt_download.md
+++ b/instruments/default/yt_download/yt_download.md
@@ -1,6 +1,6 @@
# Problem
Download a YouTube video
# Solution
-1. cd to the desired location to download
+1. If folder is specified, cd to it
2. Run instrument "bash /instruments/default/yt_download/yt_download.sh <url>" with your video URL
3. Wait for the terminal to finish
\ No newline at end of file
diff --git a/instruments/default/yt_download/yt_download.py b/instruments/default/yt_download/yt_download.py
deleted file mode 100644
index 5d3ee0826..000000000
--- a/instruments/default/yt_download/yt_download.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import subprocess
-import sys
-import os
-import argparse
-
-def install_yt_dlp():
- """Install yt-dlp using pip if it's not already installed."""
- try:
- __import__('yt_dlp')
- except ImportError:
- print("yt-dlp not found. Installing...")
- subprocess.check_call([sys.executable, "-m", "pip", "install", "yt-dlp"])
-
-def is_ffmpeg_installed():
- """Check if ffmpeg is installed by trying to run 'ffmpeg -version'."""
- try:
- subprocess.run(["ffmpeg", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- return True
- except FileNotFoundError:
- return False
-
-def install_ffmpeg():
- """Install ffmpeg on Linux using apt-get if it's not already installed."""
- if is_ffmpeg_installed():
- print("ffmpeg is already installed.")
- return
-
- print("ffmpeg not found. Installing using apt-get...")
- subprocess.check_call(["sudo", "apt-get", "install", "-y", "ffmpeg"])
-
-def download_video(url):
- """Download video using yt-dlp."""
- install_yt_dlp()
-
- yt_dlp = __import__('yt_dlp')
-
- if not is_ffmpeg_installed():
- install_ffmpeg()
-
- ydl_opts = {
- 'format': 'bestvideo+bestaudio/best', # Download best video and audio separately, merge them
- 'outtmpl': '%(title)s.%(ext)s', # Output file naming pattern
- 'merge_output_format': 'mp4', # Output format after merging
- }
-
- with yt_dlp.YoutubeDL(ydl_opts) as ydl: # type: ignore
- ydl.download([url])
-
-if __name__ == "__main__":
-
- # Parse command-line arguments
- parser = argparse.ArgumentParser(description='Download video from a URL using yt-dlp.')
- parser.add_argument('url', help='The URL of the video to download')
-
- args = parser.parse_args()
-
- # Download the video from the provided URL
- download_video(args.url)