Created
October 4, 2018 10:09
-
-
Save pyropeter/0b9cd7d5e6d4b1888e8befb9a2ea3fec to your computer and use it in GitHub Desktop.
CLI YouTube channel viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UCcXhhVwCT6_WqjkEniejRJQ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment