-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpullerMatrixLinks.js
More file actions
39 lines (36 loc) · 938 Bytes
/
pullerMatrixLinks.js
File metadata and controls
39 lines (36 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
w = require('webpage')
fs = require('fs')
linksOut = fs.open('matrixLinks.txt', 'w');
page = w.create();
page.onLoadFinished = function(status)
{
var downloads = page.evaluate(function()
{
downloads=[];
var iter = document.evaluate("//table//td//a", document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
for(var link=iter.iterateNext(); link; link=iter.iterateNext())
downloads.push(link.href);
return downloads;
});
downloads.forEach(function(link) {
linksOut.writeLine(link);
});
if(page.evaluate(function()
{
var next = document.getElementById('MainContent_btnNext1');
if(next.disabled)
return false;
else
{
next.click();
return true;
}
}))
console.log("Next");
else
{
console.log("Done");
phantom.exit(0);
}
}
page.open("http://matrixcatalog.co.il/NBCompetitionRegulations.aspx")