#!/bin/bash
#
# RJP https://puolanka.info/goto/youtube-lataaja/
# Use the latest yt-dlp https://github.com/yt-dlp/yt-dlp
#
        
TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=mp3-lataaja

TUBE="$(yad --title=$"Youtube MP3 Lataaja" --center --width=500 --height=100 --text-align=center --text=$"PUT VIDEO´S ADDRESS INTO BOX" --entry --entry-label=$"ADRESS" --entry-text="")"
if [ $? = 0 ];
then
yad --title=$"Youtube MP3 Lataaja" --center --width=500 --height=100 --text-align=center --text=$"ADDRESS IS: $TUBE"
xterm -e /bin/bash -c "yt-dlp --extractor-args "youtube:player_client=android" -x --audio-format mp3 --no-playlist -o '%(title)s.%(ext)s' $TUBE "
sleep 1
yad --width=200 --center --buttons-layout=center --borders=5 --text-align=center --title=$"READY" --text=$"MP3 ladattu" --button=OK:1 --center
else exit 0
fi
