Skip to content

Instantly share code, notes, and snippets.

@WooodHead
Forked from stocks29/.bash_aliases
Created March 29, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WooodHead/cb693e75e14c591b964b5ff43fc3898a to your computer and use it in GitHub Desktop.
Save WooodHead/cb693e75e14c591b964b5ff43fc3898a to your computer and use it in GitHub Desktop.
watch youtube channels on your raspberry pi from cli
play_video() {
youtube-dl -g $1 | xargs omxplayer
}
play_most_recent_channel_video() {
wget -q -O- "http://gdata.youtube.com/feeds/base/videos?alt=rss&orderby=published&author=$1" | grep -o '<link>http://www.youtube.com/watch[^<]*</link>' | grep -o 'http[^&]*' | head -1 | xargs youtube-dl -g | xargs omxplayer
}
play_most_recent_from_playlist() {
channels=( "UC67Vc0fkLYeUPBp1f02VY9Q" "UCKrD_GYN3iDpG_uMmADPzJQ" )
for channel in "${channels[@]}"
do
play_most_recent_channel_video $channel
done
}
alias yt=play_video
alias ytc=play_most_recent_channel_video
alias ytp=play_most_recent_from_playlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment