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 6d6b0a1befcb97b04dc45460629acdfa1ce7a78a
parent d670933b7f4f09c565540745d3d72715e4d05003
Auterice: arthur <arthur.pons@unistra.fr>
Date:   Sun,  9 Oct 2022 10:43:17 +0200

Added printing of title in console
Added additionnal documentation

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

diff --git a/README b/README @@ -1,7 +1,12 @@ -Stupid script that curls a twitch channel to know if twitch channel is live +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 +on it. + +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 diff --git a/twitch_update b/twitch_update @@ -3,16 +3,17 @@ rm -f ~/.sfeed/feeds/twitch make_feed() { - echo "$1 live, adding to 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 "Checking $1" - curl -sL https://www.twitch.tv/$1 > "$1" + echo -n "Checking $1 - " + curl -sL https://www.twitch.tv/$1 > $1 grep -q 'isLiveBroadcast":true' $1 && make_feed $1 - rm "$1" + echo + rm $1 } check_live esl_sc2