Skip to content

Instantly share code, notes, and snippets.

@leshikus
Last active December 28, 2015 23:59
Show Gist options
  • Save leshikus/7583214 to your computer and use it in GitHub Desktop.
Save leshikus/7583214 to your computer and use it in GitHub Desktop.
Check Google search results for a particular one
function waitFor(f) {
setTimeout(function() {
try {
f();
} catch (e) {
console.log('waitFor(): ' + e);
waitFor(f);
}
}, 5000);
}
l = document.getElementsByClassName('r');
for (i = l.length; i > 0;) {
var url = l[--i].firstChild.getAttribute('href');
var w = window.open(url);
waitFor(function() {
// if (w.document.innerHTML.indexOf('<article') > 0) console.log(url);
console.log(w.location.href);
w.close();
});
break;
}
// function waitFor(f) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment