检测斗鱼平台直播间是否直播

检测斗鱼平台直播间是否直播,未直播则刷新页面(默认检测间隔为 1 分钟)

// ==UserScript==
// @name         检测斗鱼平台直播间是否直播
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  检测斗鱼平台直播间是否直播,未直播则刷新页面(默认检测间隔为 1 分钟)
// @author       xilili
// @match        *://www.douyu.com/*
// @icon         https://marketplace.canva.cn/MADRpjbFvPk/1/thumbnail_large/canva-%E9%BB%84%E7%81%B0%E6%96%97%E9%B1%BC%E7%A4%BE%E4%BA%A4%E5%AA%92%E4%BD%93icon-MADRpjbFvPk.png
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 刷新当前页面
    function reload(){
        location.replace(location.href);
    }

    // 判断当前直播间直播状态,0 为未直播
    setInterval(function(){
        if(document.getElementsByClassName("video-container-dbc7dc ").length===0) {
            reload();
        }
    },1*60*1000)
})();