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 aac4d45174b0b71b593bb882456bf7906fd93df9
parent 3d9389f853ae53740215e77aba27f4f11d7bab59
Auterice: arthur <arthur.pons@unistra.fr>
Date:   Thu, 27 Oct 2022 22:38:29 +0200

Removed feed build and most streams

Should do a small article to show how you can extend script

Diffstat:
MREADME | 12++----------
Mtwitch_update | 18++----------------
2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/README b/README @@ -1,13 +1,5 @@ Stupid script that curls a twitch channel to know if channel is live. -If it is it builds a file in the sfeed(5) format so you can use sfeed_curses(1) -on it. +Prints result, hook it if you want to do something with the info -If you do not use sfeed or your sfeed content is not in standard ~/.sfeed/feeds -location the script won't work because expected folders won't exist. - -Please adapt it to your needs. You can simply remove line 8 for example. - -A typical usage would be - - ./twitch_update;sfeed_curses < ~/.sfeed/feeds/twitch +TODO Add example, add article of some sort diff --git a/twitch_update b/twitch_update @@ -1,17 +1,10 @@ #!/bin/sh -rm -f ~/.sfeed/feeds/twitch - -make_feed() { - title=$(grep -ow 'description":".\+embedUrl' $1 | cut -d\" -f3) - echo -n " live, adding to feed - $title" - echo "$(date +'%s') $title https://twitch.tv/$1 $1" >> ~/.sfeed/feeds/twitch -} - check_live() { echo -n "Checking $1 - " curl -sL https://www.twitch.tv/$1 > $1 - grep -q 'isLiveBroadcast":true' $1 && make_feed $1 + grep -q 'isLiveBroadcast":true' $1 && + echo -n $(grep -ow 'description":".\+embedUrl' $1 | cut -d\" -f3) echo rm $1 } @@ -19,10 +12,3 @@ check_live() { check_live esl_sc2 check_live pousour check_live esl_csgo -check_live esl_csgob -check_live blastpremier -check_live sweetdreams -check_live hiswattson -check_live oraxe -check_live Mande -exit 0