#!/usr/bin/env bash # open youtube link in mpv URL=https:$(awk -F'https%3a' '{print $2}' <<< "$1") if curl --head --silent $URL > /dev/null 2>&1; then echo "Opening Youtube video $URL" >> $HOME/.lynx-log notify-send "Launching mpv $URL" mpv $URL >/dev/null 2>&1 & else echo "Youtube video: invalid URL $URL" >> $HOME/.lynx-log notify-send "invalid URL $URL" fi