#!/usr/bin/env bash # open youtube link in mpv # remove gopher section of URL passed # by Lynx as mpv doesn't understand it URL=https:$(awk -F'https%3a' '{print $2}' <<< "$1") if curl --head --silent $URL > /dev/null 2>&1; then notify-send "Launching mpv $URL" mpv $URL >/dev/null 2>&1 & else notify-send "invalid URL $URL" fi