Skip to content

Instantly share code, notes, and snippets.

@pyropeter
Created October 4, 2018 10:09
Show Gist options
  • Save pyropeter/0b9cd7d5e6d4b1888e8befb9a2ea3fec to your computer and use it in GitHub Desktop.
Save pyropeter/0b9cd7d5e6d4b1888e8befb9a2ea3fec to your computer and use it in GitHub Desktop.
CLI YouTube channel viewer
This introduces a CLI command `yt` which calls `youtube-viewer`
to display a YouTube channel. The YouTube channel IDs are stored
in `~/.config/youtube/` in flat plain text files containing just
the ID. The file name is used as the argument to `yt`.
One way to find out the channel IDs is to paste a URL of a
YouTube video into the `youtube-viewer` prompt. It will
then list the channel ID in the videos metadata.
alias youtube-viewer='youtube-viewer --video-player=mpv'
function yt {
youtube-viewer -cv `cat ~/.config/youtube/$1`
}
function _yt {
COMPREPLY=( $(cd ~/.config/youtube; compgen -f -- "$2") )
}
complete -F _yt yt
UCcXhhVwCT6_WqjkEniejRJQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment