diff --git a/bin/rofi_mpvtube b/bin/rofi_mpvtube index 450ca8c..652a9fa 100755 --- a/bin/rofi_mpvtube +++ b/bin/rofi_mpvtube @@ -56,9 +56,10 @@ main() { # Get URL linktoplay="$(grep -m 1 "$choice" $playlist_file | cut -d '@' -f 2)" - # If the choice does not exist, exit + # If the choice does not exist, try searching for it if [ ${#linktoplay} -eq "0" ]; then - exit 1 + yid=$(youtube-dl ytsearch:"$choice" -s | grep "\[youtube\]" | cut -d ']' -f 2 | awk -F ':' '{print $1}' | cut -c 2-) + linktoplay=https://www.youtube.com/watch\?v\="$yid" fi # Send notification