Skip to content

Instantly share code, notes, and snippets.

@Zazcallabah
Created May 25, 2020 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zazcallabah/3b1a13c96f709a9143ae12a294efba7d to your computer and use it in GitHub Desktop.
Save Zazcallabah/3b1a13c96f709a9143ae12a294efba7d to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name t
// @version 0.1
// @grant none
// @run-at document-end
// ==/UserScript==
window.addEventListener ("load", pageFullyLoaded);
function getProfile() {
var cards = document.getElementsByClassName("BreakWord");
if( cards.length > 0) {
if( cards.length == 1 ) {
return cards[0].innerText || "";
}
for( var i = 0; i<cards.length; i++) {
var card = cards[i];
var ancestor = card.parentElement.parentElement.parentElement.parentElement.parentElement;
if( ancestor && ancestor.attributes && ancestor.attributes["aria-hidden"] && ancestor.attributes["aria-hidden"].value == "false") {
return card.innerText;
}
}
}
return "";
}
function pageFullyLoaded () {
window.counter = 0;
var gogo = function gogo(){
if( window.counter < 55 )
{
var lookupstr = "//button[@aria-label='Nope']";
if( getProfile().length > 150 || Math.random() > 0.4 ){
lookupstr = "//button[@aria-label='Like']";
window.counter++;
}
document.evaluate(lookupstr, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click()
setTimeout(gogo,(5+9*Math.random())*1000);
}
else
{
window.location = "https://google.com"
}
}
setTimeout(gogo, (4+Math.random()*10)*1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment