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 e2a05defde6684a7d50e00db51b1ddcc2b671943
parent df4223cff78a6c96e0637639c4c0a9cf485902f3
Auterice: arthur <arthur.pons@unistra.fr>
Date:   Tue,  4 Oct 2022 12:23:01 +0200

Merge branch 'sullygnome'

Diffstat:
MREADME | 5+++--
Mtwitch_update | 34++++++++++++++++------------------
2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/README b/README @@ -1,3 +1,4 @@ -Stupid script that uses twitchtracker website to know if a twitch channel is live +Stupid script that curls a twitch channel to know if twitch channel is live -Isn't reliable, twitchtracker often default to a 503 error when "spammed" +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,28 +1,26 @@ -#! /bin/sh +#!/bin/sh rm -f ~/.sfeed/feeds/twitch make_feed() { - echo -n "live" - 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 } check_live() { - echo -n "$1 status : " - curl -sL https://twitchtracker.com/search?q=$1 | grep -A1 "<a href=\"/$1\" class=\"item-title\">" | grep -q "twitch-live-circle" && make_feed $1 - echo "" - # Otherwise twitchtracker.com overloads - sleep 2 + echo "Checking $1" + curl -sL https://www.twitch.tv/$1 > "$1" + grep -q 'isLiveBroadcast":true' $1 && make_feed $1 + rm "$1" } -check_live esl_sc2 -check_live shivfps -check_live pousour -check_live tfue -check_live diegosaurs -check_live esl_csgo -check_live blastpremier -check_live sweetdreams -check_live rogue -check_live daltoosh +check_live esl_sc2 +check_live pousour +check_live esl_csgo +check_live blastpremier +check_live sweetdreams +check_live hiswattson +check_live oraxe +check_live Mande exit 0