Hey guys I have a tamper monkey script that I'm writing to scrape links off a webpage, store them into an array, then somehow going through each link of the array to grab information inside those links.
So lets say I have an array "turls" with 25 links scraped from the main page, and I use window.location.href to go into the links and window.history.back(); to go back to the main page. Once I return to the main page, the script would run again, and go into the first link again.
I think I can go on to the next link after I comeback to the main page where all the links are with GM_setvalue and GM_getvalue, but how? I'm not sure how to go about this to go through all 25 links.
thanks in advance,
(also the console.log result of urls and turls show up in the chrome console as an array of 300 and an array of 25, but urls and turls isnt defined when I typed console.log(urls) or console.log(turls) into the chrome console.)
// ==/UserScript==
(function() {
'use strict';
var urls= [];
var turls = [];
$( document ).ready(function() {
for (var i= document.links.length; i-->0;){
if (document.links[i].hostname===location.hostname){
if (document.links[i].href.indexOf("tournaments") > -1) {
turls.push(document.links[i].href);
}
urls.push(document.links[i].href);
}
}
});
console.log(urls);
console.log(turls);
})();