#!/bin/bash # Instalar dependencias si no existen install_deps() { echo "Verificando dependencias..." if ! command -v streamlink &> /dev/null; then echo "Instalando streamlink..." sudo pacman -S streamlink --noconfirm fi if ! command -v ffmpeg &> /dev/null; then echo "Instalando ffmpeg..." sudo pacman -S ffmpeg --noconfirm fi echo "Dependencias listas!" } # Descargar video de Twitch download() { if [ -z "$1" ]; then echo "Usage: bajar " echo "Ejemplo: bajar https://www.twitch.tv/videos/2699641307" return 1 fi install_deps URL="$1" OUTPUT_FILE="./$(date +%Y%m%d_%H%M%S)_twitch.mp4" echo "Descargando: $URL" echo "Guardando en: $OUTPUT_FILE" streamlink "$URL" best -o "$OUTPUT_FILE" if [ $? -eq 0 ]; then echo "¡Descarga completada! Archivo: $OUTPUT_FILE" else echo "Error en la descarga" fi } download "$@"