Last active
December 4, 2024 11:17
-
-
Save heerdt/cebc7eb16a1ae87859bc70234c67e846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by Rafael Broering de Souza, não tão bom programador, muito menos sniper no cod | |
function checkAvailableSpots(){ | |
let xhr = new XMLHttpRequest(); | |
xhr.withCredentials = true; | |
xhr.open('GET', 'https://myroadsafety.rsa.ie/api/v1/Availability/All/5a35bbab-7f79-ee11-af86-005056b9b50c/0fed074d-c2d6-e811-a2c0-005056823b22'); | |
xhr.setRequestHeader('Accept', 'application/json, text/plain, */*'); | |
xhr.setRequestHeader('Accept-Language', 'en-GB,en-US;q=0.9,en;q=0.8'); | |
xhr.setRequestHeader('Authorization', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InJhZmFlbC5mZnNAaG90bWFpbC5jb20iLCJ1bmlxdWVfbmFtZSI6IlJBRkFFTCIsImZhbWlseV9uYW1lIjoiQlJPRVJJTkcgREUgU09VWkEiLCJzdWIiOiJiNDQxZWU4Yi1mY2ZkLWVkMTEtYTJmZS0wMDUwNTY4MjU0ZWIiLCJwcHNuIjoiMTAyNzc4NElBIiwiMmZhYXV0aCI6InRydWUiLCJteWdvdiI6InRydWUiLCJteWdvdnRva2VuIjoiZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNkluTnBaMjVwYm1kclpYa3ViWGxuYjNacFpDNTJNU0lzSW5SNWNDSTZJa3BYVkNKOS5leUoyWlhJaU9pSXhMakFpTENKcGMzTWlPaUpvZEhSd2N6b3ZMMkZqWTI5MWJuUXViWGxuYjNacFpDNXBaUzlsTVRrM1pXRTVaUzB3TW1VMUxUUmpZall0T1RaaU1pMDFOVGN4WTJRMk5EVTNOVFF2ZGpJdU1DOGlMQ0p6ZFdJaU9pSklUVlowYkVoRkwyZGpibU16VTA5TlZrSkhha2RS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xTFV4SlZrVWlMQ0pEYjNKeVpXeGhkR2x2Ymtsa0lqb2lOMk01TkRoaE1tVXROamhsTWkwMFpXUTJMV0kyTWpJdFlqRXdZbUZoTkRVM1ltWXdJaXdpYm1KbUlqb3hOekF3TkRnMk56RXdmUS5wbncwWEdFVzdLd1doUGJsaE01MFA5NW1xRi05ZTZvZV9Ra3g1NmFNREdIbmVnTk11VWJSUTNDRndYZ0RJbnBkTkExTXhEWFBUbkVJcS1kWEJJN0h3ZUxYRy1LWmlfa1RaMlVBRktsd0ZrNDBlSUxIWDNxbk1jcnQ2NWN6d2lEMno1OXFlM0d3UUNkSGFiei1lMHhFLUdhUVpYcnItSWg4VXZselhaZnplNnV0c3ZpUm91MUMxcUdTWlJOQlNSajA3UWduUkR4bWJxWEFRV1libXZsRE9udXdIeHE0UDQzQ1RZLUhFWVhfcXRXdURpMHBJNUtidG9RRWtJZXRWQ29VeUY1dERMZjZkdTd6c1diQ25rVkdNdG9LZHNmTzNfcHAzeDN0UDRNV1ZtVTNhZFR1MUd6SFlUR3JhV1FfeWlSMXFBQVBCaGJhaGtqV19ZYnBXNkhTUHciLCJuYmYiOjE3MDA0ODY3MTAsImV4cCI6MTcwMDQ5MzkxMCwiaWF0IjoxNzAwNDg2NzEwLCJpc3MiOiJteXJvYWRzYWZldHkucnNhLmllIiwiYXVkIjoibXlyb2Fkc2FmZXR5LnJzYS5pZSJ9.8rSmCm7r8LiE1z_gWZhhdI4sc-rrUJ5ZR69xg69lNWA'); | |
xhr.setRequestHeader('Cache-Control', 'no-cache'); | |
xhr.onload = function() { | |
var result = JSON.parse(xhr.response); | |
var total = ""; | |
for (let i = 0; i < result.length; i++) { | |
if(result[i].nextAvailability != '0001-01-01T00:00:00Z' && result[i].county == 'Dublin'){ | |
total += result[i].name + "-" + result[i].nextAvailability + "\n"; | |
} | |
} | |
tempAlert(total, 10000); | |
}; | |
xhr.send(); | |
}; | |
function cleanRefresh(){ | |
if(document.getElementsByClassName("cdk-overlay-pane").length >= 1){ | |
$(".cdk-overlay-pane button")[2].click(); | |
}; | |
} | |
function tempAlert(msg,duration) | |
{ | |
var el = document.createElement("div"); | |
el.setAttribute("style","position:absolute;top:10%;left:40%;background-color:#8f8f8f;float:left;z-index:1000000;width:500px;height:500px;color: white;"); | |
el.setAttribute("id", "TESTE"); | |
el.innerHTML = msg; | |
setTimeout(function(){ | |
el.parentNode.removeChild(el); | |
},duration); | |
document.body.appendChild(el); | |
} | |
var interval = setInterval(function() { | |
cleanRefresh(); | |
checkAvailableSpots(); | |
}, 60000); | |
checkAvailableSpots(); | |
//clearInterval(interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nunca é merito