How to scrap this link


#1

I have written this , but doesnot work

https://caodc.ca/AF_MemberDirectory.asp?pagesize=&keyword=&intpage=2&page=1&dlist=4

function pageFunction(context) {
// called on every page the crawler visits, use it to extract data from it
var $ = context.jQuery;
var i;
var company_name ;
var newdata;
for(i=2;i<=2;i++){
context.enqueuePage({
url: “https://caodc.ca/AF_MemberDirectory.asp?pagesize=&keyword=&intpage="+i+"&page=1&dlist=4”,
});
}

var directory = [];
$('.width-max').each(function(){
    
  company_name = $(this).find('td').text();
  newdata = company_name.split('<br/>');
  var data0 = newdata[0];
  
  var obj = {
      
      data0:data0,
  }
  directory.push(obj);
});

return directory;

}


#2

Hi @vqube,

I looked at it and it should work.
It should enqueue page:
https://caodc.ca/AF_MemberDirectory.asp?pagesize=&keyword=&intpage=2&page=1&dlist=4 in queue.

But for simplification you can call just:

context.enqueuePage({
  url: "https://caodc.ca/AF_MemberDirectory.asp?pagesize=&keyword=&intpage=2&page=1&dlist=4",
});

or put this URL to startUrls.

Have a nice day,
Jakub D.