diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-05-05 17:45:32 -0700 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-05-05 17:45:32 -0700 |
commit | 18cbaf310697d7aee38819fa21b2feffb1f7073a (patch) | |
tree | 122eb77f5e88deec958927ec76f486f38029f46f /sh/dyafk | |
parent | 7b0570e094944d86fe44660452f551813f151c92 (diff) |
add dyafk
Diffstat (limited to 'sh/dyafk')
-rwxr-xr-x | sh/dyafk | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sh/dyafk b/sh/dyafk new file mode 100755 index 0000000..b6da7ec --- /dev/null +++ b/sh/dyafk @@ -0,0 +1,18 @@ +#!/bin/sh +# DouYu AFK + +# maybe another way: https://open.douyu.com/source + +while :; do + # credit: MIT licensed https://github.com/DIYgod/RSSHub/blob/master/lib/routes/douyu/room.ts + if [ "$(curl -s https://www.douyu.com/betard/9640128 | jq -r '.room.show_status')" -eq 1 ]; then + if ! pidof -q firefox; then + firefox --headless --profile "$HOME/.mozilla/firefox/dyafk" https://www.douyu.com/9640128 & + fi + else + kill $(pidof firefox) + fi + # open.douyu.com AUP for api request seems very high, about 6k/min per api? see https://open.douyu.com/source/api/5 + # although I don't use open.douyu.com api but can be used as a reference, so I think 1 request per minute is ok + sleep 60 +done |