Skip to content

Instantly share code, notes, and snippets.

@mattkirwan
Created June 1, 2015 10:33
Show Gist options
  • Save mattkirwan/9008e8f124cd73093d93 to your computer and use it in GitHub Desktop.
Save mattkirwan/9008e8f124cd73093d93 to your computer and use it in GitHub Desktop.
A quick bash script to get the latest RDAD twitchers and show there current streaming status.
#!/bin/bash
twitch_accounts=()
while read line
do
twitch_accounts+=("$line")
done < <(curl http://www.reddit.com/r/RedditDads/wiki/twitch_and_youtube | grep "* http://www.twitch.tv/" | sed 's/* http\:\/\/www\.twitch\.tv\//\ /;s//\n/')
for twitch_account in "${twitch_accounts[@]}"
do
twitch_account="${twitch_account//[[:space:]]/}"
status_response=$(curl -sS --silent -H 'Accept: application/vnd.twitchtv.v3+json' -X GET "https://api.twitch.tv/kraken/streams/$twitch_account" | sed -e "s,.*\"stream\"\:null.*,"$(printf "\033[31mOFFLINE\033[0m")"," -e t -e "s,.*,"$(printf "\033[32mLIVE\033[0m")",")
echo "$twitch_account: $status_response"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment