AUTORUN;
var s: String;
var tab: Tstringlist;tab:=Tstringlist.create;
var i: integer;
var description : string;
var email : string;
var Raison_sociale : string;
var site : string;
var telephone : string;
var ajoutes:integer;
showmessage('Ce script a pour but de vous montrer l''aspiration des données à partir des pages jaunes CANADA');
navigate('http://business.superpages.ca/');
showmessage('Choisissez votre catégorie, votre provence et naviguez jusqu''aux premiers résultats');
repeat;
sleep(10);
until pos('CID',getBrowserUrl(1))>0;
createTable('Raison_sociale','email','description','site','telephone');
SetUniqueColumn('Raison_sociale');
showDataBase;
repeat;
ajoutes:=recordCount;
for i:=1 to 51 do begin;
s:='TD(1)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR('+inttostr(i)+')/TBODY(0)/TABLE(0)/TD(0)/TR(0)/TBODY(0)/TABLE(1)/BASEFONT(0)/BODY(0)/BASE(0)/HEAD(0)/HTML(0)/';
tab.text:=getText(s,1);
s:=tab.text;
if (tab.count)>4 then begin;
Raison_sociale:=tab[0];
description:=tab[1];
telephone:=tab[2];
email:=extractEmails(tab.text);
site:=extractUrlsfromString(tab.text);
insertData(description,email,Raison_sociale,site,telephone);
end;
end;
s:=getBrowserUrl(1);
clickForm('A(0)/SPAN(0)/FONT(0)/TD(0)/TR(0)/TBODY(0)/TABLE(0)/DIV(0)/TD(0)/TR(0)/TBODY(0)/TABLE(1)/BASEFONT(0)/BODY(0)/BASE(0)/HEAD(0)/HTML(0)/',1);
s:=getBrowserUrl(1);
ajoutes:=recordcount-ajoutes;
until (ajoutes=0);