Skip to content

Instantly share code, notes, and snippets.

@trufae
Created February 28, 2024 10:13
Show Gist options
  • Save trufae/ae9f9e74e204954218ac67a1f6660de0 to your computer and use it in GitHub Desktop.
Save trufae/ae9f9e74e204954218ac67a1f6660de0 to your computer and use it in GitHub Desktop.
yt
#!/bin/sh
pkill mpv
q=$(echo $@ | sed -e 's/ /%20/g')
res=$(curl -s "https://www.youtube.com/results?search_query=$q" | sed -e 's/}/\n/g' -e 's/{/\n/g' | grep videoId | grep ']$' |sort -u | cut -d '"' -f 4 | grep -v '%' )
CMD="mpv --shuffle --no-video"
for a in $res ; do
CMD="$CMD ytdl://$a"
done
eval $CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment