Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4 to your computer and use it in GitHub Desktop.
Save Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4 to your computer and use it in GitHub Desktop.
Auto reloads the page after a certain amount of time has passed to prevent stream freezing/crashing
// ==UserScript==
// @name Autoreload giveaway channel streams
// @namespace https://kurotaku.de
// @version 1.5.6
// @description Auto reloads the page after a certain amount of time has passed to prevent stream freezing/crashing
// @author Kurotaku
// @license MIT
// @match https://www.twitch.tv/hitsquad*
// @match https://www.twitch.tv/redrewards
// @match https://www.twitch.tv/thegiftingchannel
// @match https://www.twitch.tv/TheGiftingChannel
// @match https://www.twitch.tv/staggerrilla
// @match https://www.youtube.com/@HitsquadGodfather/live
// @icon https://static.twitchcdn.net/assets/favicon-32-e29e246c157142c94346.png
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js
// @updateURL https://gist.github.com/Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4/raw/Autoreload%2520giveaway%2520channel%2520streams.user.js
// @downloadURL https://gist.github.com/Kurotaku-sama/d9756df6bac5572076b04984b9e09dd4/raw/Autoreload%2520giveaway%2520channel%2520streams.user.js
// @require https://gist.github.com/Kurotaku-sama/9ebeb659500f6eee2f780344948e1e8f/raw/kuros_library.user.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// ==/UserScript==
(async function() {
await init_gm_config(); // Initialize the configuration
if(GM_config.get("script_enabled")) {
const loc = location.href.toLowerCase();
if(loc.includes("hitsquad") && GM_config.get("twitch_hsgf_timer_enabled")) {
await Sleep(GM_config.get("twitch_hsgf_timer") * 1000 * 60);
location.reload();
}
if(loc.includes("redrewards") && GM_config.get("twitch_rr_timer_enabled")) {
await Sleep(GM_config.get("twitch_rr_timer") * 1000 * 60);
location.reload();
}
if(loc.includes("thegiftingchannel") && GM_config.get("twitch_tgc_timer_enabled")) {
await Sleep(GM_config.get("twitch_tgc_timer") * 1000 * 60);
location.reload();
}
if(loc.includes("staggerrilla") && GM_config.get("twitch_staggerrilla_timer_enabled")) {
await Sleep(GM_config.get("twitch_staggerrilla_timer") * 1000 * 60);
location.reload();
}
if(location.href === "https://www.youtube.com/@hitsquadgodfather/live" && GM_config.get("youtube_hsgf_timer_enabled")) {
await Sleep(GM_config.get("youtube_hsgf_timer") * 1000 * 60);
location.reload();
}
}
})();
function init_gm_config() {
GM_registerMenuCommand('Settings', () => {
GM_config.open();
});
let frame = document.createElement('div');
document.body.appendChild(frame);
GM_config.init(
{
'id': 'configuration',
'title': 'Autoreload config',
'fields':
{
'script_enabled':
{
'label': 'Enable/Disable the script',
'type': 'checkbox',
'default': true
},
'twitch_hsgf_timer_enabled':
{
'label': 'Twitch HitsquadGodfather autoreload enabled<br>(Include the other hitsquad channels)',
'type': 'checkbox',
'default': true
},
'twitch_hsgf_timer':
{
'label': 'Twitch HitsquadGodfather reloadtime in minutes',
'type': 'textbox',
'default': '30'
},
'twitch_rr_timer_enabled':
{
'label': 'Twitch RedRewards autoreload enabled',
'type': 'checkbox',
'default': true
},
'twitch_rr_timer':
{
'label': 'Twitch RedRewards reloadtime in minutes',
'type': 'textbox',
'default': '30'
},
'twitch_tgc_timer_enabled':
{
'label': 'Twitch TheGiftingChannel autoreload enabled',
'type': 'checkbox',
'default': true
},
'twitch_tgc_timer':
{
'label': 'Twitch TheGiftingChannel reloadtime in minutes',
'type': 'textbox',
'default': '30'
},
'twitch_staggerrilla_timer_enabled':
{
'label': 'Twitch Staggerrilla autoreload enabled',
'type': 'checkbox',
'default': true
},
'twitch_staggerrilla_timer':
{
'label': 'Twitch Staggerrilla reloadtime in minutes',
'type': 'textbox',
'default': '30'
},
'youtube_hsgf_timer_enabled':
{
'label': 'YouTube HitsquadGodfather autoreload enabled',
'type': 'checkbox',
'default': false
},
'youtube_hsgf_timer':
{
'label': 'YouTube HitsquadGodfather reloadtime in minutes',
'type': 'textbox',
'default': '30'
},
},
'events': {
'save': () => {location.reload()},
},
'frame': frame,
'css': '#configuration {color: black; height:auto !important; width:auto !important; padding:20px !important;max-height: 600px !important;max-width:500px !important; border: 3px solid #000 !important} #configuration .section_header {background: unset; color:unset;} #configuration .config_header {font-size:17pt; font-weight:bold} #configuration .config_var {margin-top:10px; display: flex;} .config_var :nth-child(2) {order:-1; margin-right:10px;} #configuration_buttons_holder {text-align: center;} #configuration #configuration_resetLink {color:#fff;}'
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment