Twitch不在直播就自动刷新

每3分钟检测是否在直播,没在直播就刷新页面

// ==UserScript==
// @name         Twitch不在直播就自动刷新
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  每3分钟检测是否在直播,没在直播就刷新页面
// @author       冰封
// @match        https://www.twitch.tv/playapex
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitch.tv
// @grant        none
// @license      GPL-3.0-only
// ==/UserScript==

(function() {
    'use strict';
    function reload(){
        //window.location.reload(true);
        location.replace(location.href);
    }
    setInterval(function () {
        if (document.getElementsByClassName("live-indicator-container").length == 0){
            reload();
        }
    }, 3*60*1000);
})();