dotfiles/scripts/yt-audio
rpriven 5b6af65def
Organize scripts and clean up dotfiles
Changes:
- Added 80+ scripts with organized structure
  - payloads/ for third-party pentesting tools
  - pentesting/ for custom security scripts
  - Daily drivers remain flat for fast access
- Converted wes() function to proper script
- Removed .sh extensions from pentesting scripts
- Cleaned up aliases (removed 31 redundant lines)
- Added kanata/, build artifacts to gitignore
- Removed old fre.sh scripts and empty a.out
- Updated configs: helix, tmux, zsh, ulauncher, redshift

Security: All sensitive data excluded via gitignore
2025-11-07 14:48:21 -07:00

43 lines
978 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Script Name: yt-audio
# Description: Download audio-only from YouTube/media sites
# Author: Custom (inspired by Evan Hahn's getsong)
# Usage: yt-audio <url>
# yt-audio <url> --format m4a
if [[ $# -eq 0 ]]; then
echo "Usage: yt-audio <url> [--format mp3|m4a|opus]" >&2
echo "Example: yt-audio 'https://youtube.com/watch?v=xxxxx'" >&2
exit 1
fi
if ! command -v yt-dlp &>/dev/null; then
echo "Error: yt-dlp not found. Install with: sudo apt install yt-dlp" >&2
exit 1
fi
url="$1"
format="${2:-mp3}" # Default to mp3
# Remove -- prefix if present
format="${format#--format }"
format="${format#--}"
echo "🎵 Downloading audio from: $url"
echo "📁 Format: $format"
echo ""
# Download audio-only in best quality
yt-dlp \
--extract-audio \
--audio-format "$format" \
--audio-quality 0 \
--embed-thumbnail \
--embed-metadata \
--output "%(title)s.%(ext)s" \
"$url"
echo ""
echo "✅ Download complete!"