System: Windows 8.1 64bit with binary from the main page, version 2.0
I have a .txt file with 1 URL per line, I read every line and open the page, searching for a specific url.match (changed domain for privacy reasons in the code) - if found,print the found JSON, abort request, unload page. My .txt file contains 12500 links, for testing purpose I split it into the first 10/100/500 urls.
Problem 1: If I try 10 urls, it prints 9 and uses 40-50% cpu afterwards
Problem 2: If I try 100 urls, it prints 98, uses 40-50% cpu afterwards for whatever reasons, then it crashes after 2-3 minutes.
Problem 3: Same goes for 98 links (it prints 96, uses 40-50% cpu, then crashes too) and for 500 links
TXT-files: https://www.dropbox.com/s/eeiy12ku5k15226/sitemaps.7z?dl=1
Crash dumps for 98, 100 and 500 links: https://www.dropbox.com/s/ilvbg8lv1bizjti/Crash%20dumps.7z?dl=1
console.log('Hello, world!');
var fs = require('fs');
var stream = fs.open('100sitemap.txt', 'r');
var line = stream.readLine();
var webPage = require('webpage');
var i = 1;
while(!stream.atEnd() || line != "") {
//console.log(line);
var page = webPage.create();
page.settings.loadImages = false;
page.open(line, function() {});
//console.log("opened " + line);
page.onResourceRequested = function(requestData, request) {
//console.log("BEFORE: " +requestData.url);
var match = requestData.url.match(/example.com\/ac/g)
//console.log("Match: " + match);
//console.log("Line: " + line);
//console.log("Match: " + match);
if (match != null) {
var targetString = decodeURI(JSON.stringify(requestData.url));
var klammerauf = targetString.indexOf("{");
var jsonobjekt = targetString.substr(klammerauf, (targetString.indexOf("}") - klammerauf) + 1);
targetJSON = (decodeURIComponent(jsonobjekt));
console.log(i);
i++;
console.log(targetJSON);
console.log("");
request.abort();
page.close();
}
};
var line = stream.readLine();
}
//console.log("File closed");
//stream.close();