Request rate reloader

mordea

Master of a Couple Things
Contributor
Joined
Jan 22, 2016
Messages
821
Reaction score
2,592
Points
568
Location
Ohio
Gender
Male
Request rate reloader

While working on a queue of HITs, I prefer to load them in background tabs and work my way down the line. Even though I have tabs set to open one second apart, some of them are bound to occasionally exceed the request rate threshold. This little script will simply reload any pages on https://www.mturk.com/mturk/* which hit the request rate wall. The script will reload the page 4 seconds after it's initiated (typically once the page has fully loaded).

Code:
// ==UserScript==
// @name         mturk request rate reloader
// @version      1.0
// @include      https://www.mturk.com/mturk/*
// @author       mordea
// @namespace    mordea
// @description  Automatically reloads pages which hit the refresh rate wall.
// @grant        none
// ==/UserScript==

var content = document.body.textContent || document.body.innerText;
var hasText = content.indexOf("You have exceeded the maximum allowed page request rate for this website.")!==-1;
if(hasText){
   setTimeout(function(){
       window.location.reload()
   },4000);
}