You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
870 B
Bash

#!/bin/bash
login="56knews"
tmpFile="/tmp/.viewers.tmp"
viewersFile="/tmp/viewers.txt"
rm -rf $tmpFile $viewersFile
function main(){
while :
do
getViewers
getModerators
getBroadcaster
sleep 60
done
}
function getViewers(){
curl -s -X GET "https://tmi.twitch.tv/group/user/$login/chatters" | jq .chatters | jq .viewers | grep -i "\"" | cut -d "\"" -f 2 >> $tmpFile
cat $tmpFile | sort -u > $viewersFile
}
function getModerators(){
curl -s -X GET "https://tmi.twitch.tv/group/user/$login/chatters" | jq .chatters | jq .moderators | grep -i "\"" | cut -d "\"" -f 2 >> $tmpFile
cat $tmpFile | sort -u > $viewersFile
}
function getBroadcaster(){
curl -s -X GET "https://tmi.twitch.tv/group/user/$login/chatters" | jq .chatters | jq .broadcaster | grep -i "\"" | cut -d "\"" -f 2 >> $tmpFile
cat $tmpFile | sort -u > $viewersFile
}
main