twitch-online

Savoir si une chaîne twitch est en ligne - retour accueil

git clone git://bebou.netlib.re/twitch-online
Log | Files | Refs | README |

commit 9bd31ccaa402527b6e3f70b48284d3e4f36b2907
parent 160967e95ecc63185e1ff6bb8b15d24449640619
Auterice: arthur <arthur.pons@unistra.fr>
Date:   Tue,  4 Oct 2022 12:20:00 +0200

Use data found on twitch channel rather than sullygnome

Diffstat:
MREADME | 2+-
Mtwitch_update | 19+++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/README b/README @@ -1,4 +1,4 @@ -Stupid script that uses Sullygnome website to know if twitch channel is live +Stupid script that curls a twitch channel to know if twitch channel is live If it is it builds a file in the sfeed(5) format so you can use sfeed_curses(1) on it diff --git a/twitch_update b/twitch_update @@ -1,23 +1,26 @@ -#! /bin/sh +#!/bin/sh rm -f ~/.sfeed/feeds/twitch make_feed() { - echo "$(date +'%s') https://twitch.tv/$1 $1" >> ~/.sfeed/feeds/twitch + echo "$1 live, adding to feed" + title=$(grep -ow 'description":".\+embedUrl' $1 | cut -d\" -f3) + echo "$(date +'%s') $title https://twitch.tv/$1 $1" >> ~/.sfeed/feeds/twitch + rm "$1" } check_live() { - curl -sL sullygnome.com/channel/$1 | grep -q "Online now" && make_feed $1 + echo "Checking $1" + curl -sL https://www.twitch.tv/$1 > "$1" + grep -q 'isLiveBroadcast":true' $1 && make_feed $1 } check_live esl_sc2 check_live pousour -check_live shivfps -check_live rogue -check_live daltoosh -check_live tfue -check_live diegosaurs check_live esl_csgo check_live blastpremier check_live sweetdreams +check_live hiswattson +check_live oraxe +check_live Mande exit 0