Skip to content

Instantly share code, notes, and snippets.

@pr0PM
Last active December 11, 2022 14:52
Show Gist options
  • Save pr0PM/7142723e97e8904400b730e07cfa59d1 to your computer and use it in GitHub Desktop.
Save pr0PM/7142723e97e8904400b730e07cfa59d1 to your computer and use it in GitHub Desktop.
Find and stream the song you wish to listen directly from terminal ft. bash
#!/usr/bin/env bash
set -euo pipefail
# dependencies:
## mpv
## youtube-dl
mpv --player-operation-mode=pseudo-gui "$(yt-dlp "ytsearch: $*" -g | sed -n '2p')" &
# sed -n '2p'
# to select the second line of output from the search results of
# youtube-dl which is the link to audio file in best format.
# psudo-gui mode to get the mpv gui and running it in bg to get the
# prompt back in terminal
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment