
Utilizamos youtube-dl y zenity para tal fin. De no tener estos paquetes instalados en el sistema, los instalaremos ejecutando en el terminal:

sudo pacman -S youtube-dl zenity

sudo su apt-get install youtube-dl zenityPara ello solo necesitamos copiar y pegar el siguiente código en un fichero de texto.
#!/bin/bash # Youtube mp3 # Autor: Esteban C. Sanz function INPUT() { zenity --entry --title="Youtube video" --text="Introduce URL de youtube:" --width=400 } if [ -d '~/Youtube video/' ]; then mkdir ~/'Youtube video' fi cd ~/'Youtube video' while : ; do URL=`INPUT` if [ -n "$URL" ] ; then # Si la variable no es null #CARPETA=$(zenity --file-selection --directory);echo $CARPETA #cd $CARPETA youtube-dl $URL | zenity --progress --width=400 --height=100 --title="Youtube video" --text "Descargando video. Por favor, espere. Este proceso puede durar varios minutos." --auto-close --pulsate notify-send "Archivo descargado." -t 2000 else exit 0 fi doneLo guardamos como youtube-video. Una vez hecho esto, le damos permisos de ejecución con:
chmod +x /ruta del archivo/youtube-video
0 comentarios:
Publicar un comentario