chore: add automation to perform clicks on rewards.bing.com
This commit is contained in:
+56
-2
@@ -1,15 +1,66 @@
|
||||
// ==UserScript==
|
||||
// @name Bing Rewarder
|
||||
// @namespace bing
|
||||
// @description Search for 30 random words on bing to rack up reward points, just search bing once to start script
|
||||
// @description Utilities to semiautomate Bing reward point redemption
|
||||
// @include https://www.bing.com/*
|
||||
// @version 1.5
|
||||
// @match https://rewards.bing.com/
|
||||
// @version 1.6
|
||||
// @updateURL https://git.alexbcberio.com/alexbcberio/userscripts/raw/branch/main/bing-rewarder/index.js
|
||||
// @downloadURL https://git.alexbcberio.com/alexbcberio/userscripts/raw/branch/main/bing-rewarder/index.js
|
||||
// @grant GM.registerMenuCommand
|
||||
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
switch (location.host) {
|
||||
case "rewards.bing.com":
|
||||
break;
|
||||
case "bing.com":
|
||||
case "www.bing.com":
|
||||
bingSearch();
|
||||
break;
|
||||
}
|
||||
|
||||
function bingRewards() {
|
||||
// Wait times to close tab
|
||||
const minBaseTimeout = 3000;
|
||||
const maxBaseTimeout = 5000;
|
||||
// Extra time to wait to perform next click
|
||||
const minExtraTimeout = 500;
|
||||
const maxExtraTimeout = 1750;
|
||||
|
||||
const pendingElements = document.querySelectorAll("mee-rewards-points .mee-icon-AddMedium");
|
||||
|
||||
if (pendingElements.length > 0) {
|
||||
GM.registerMenuCommand("Collect points", collectPoints);
|
||||
}
|
||||
|
||||
function collectPoints() {
|
||||
collectPoint(0);
|
||||
}
|
||||
|
||||
function collectPoint(num) {
|
||||
if (!pendingElements[num]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const link = pendingElements[num].closest("a");
|
||||
const timeoutMs = minBaseTimeout + Math.random() * (maxBaseTimeout - minBaseTimeout);
|
||||
|
||||
if (link) {
|
||||
const linkLocation = link.getAttribute("href");
|
||||
const tab = window.open(linkLocation);
|
||||
setTimeout(() => {
|
||||
tab.close();
|
||||
}, timeoutMs);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
collectPoint(num+1);
|
||||
}, timeoutMs + minExtraTimeout + Math.random() * (maxExtraTimeout - minExtraTimeout));
|
||||
}
|
||||
}
|
||||
|
||||
function bingSearch() {
|
||||
GM.registerMenuCommand("Start searching", doSearch);
|
||||
|
||||
const urlSearchParams = new URLSearchParams(location.search);
|
||||
@@ -82,3 +133,6 @@ function createRandomWord(desiredLength) {
|
||||
}
|
||||
return word;
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user