#!/bin/sh
# requires xclip youtube-dl dunstify
msgId="9910048"
linkk="$(xclip -o -selection primary)"
download(){
    dunstify "Started downloading $linkk" -a "Youtube Downloader" -u low -r "$msgId"
    youtube-dl --extract-audio --audio-format vorbis -o '$HOME/Music/nixos/\%(title)s.%(ext)s' $linkk
    dunstify "FINISHED downloading $linkk" -a "Youtube Downloader" -u low -r "$msgId"
}
echo "$linkk"
case "$linkk" in
    *youtube.com*) download;;
    *) dunstify "ERROR!!! ${linkk} is not a valid youtube url" -u critical;;
    esac
