#!/bin/bash

# Ask for the final filename first
echo "=== Video Downloader (yt-dlp + aria2c) ==="
read -p "Enter the final filename (without extension): " filename

# Then ask for the m3u8 URL
read -p "Enter the m3u8 URL: " url

# Download using yt-dlp with aria2c
echo "Starting download..."
yt-dlp --external-downloader aria2c \
       --external-downloader-args "aria2c:-x 16 -s 16" \
       -o "${filename}.%(ext)s" \
       "$url"

echo "Download complete: ${filename}.mp4"
