import yt_dlp | |
import os | |
import uuid | |
from akn.utils.logger import LOGS | |
def all_one_downloader(url: str, download_path: str = "./downloads/"): | |
unique_id = str(uuid.uuid4()) | |
ydl_opts = { | |
"outtmpl": os.path.join(download_path, f"{unique_id}.%(ext)s"), | |
"quiet": True, | |
"noplaylist": True, | |
"format": "best", | |
} | |
with yt_dlp.YoutubeDL(ydl_opts) as ydl: | |
info = ydl.extract_info(url, download=True) | |
video_title = info.get("title", "Video") | |
video_path = ydl.prepare_filename(info) | |
return video_path, video_title |