primera version

master
fanta 2 years ago
parent ad47cd90f9
commit 352766c194

@ -0,0 +1,32 @@
#!/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
Loading…
Cancel
Save