Page 1 of 1

Google Search, Results Sites Extraction...

Posted: Wed Mar 07, 2012 7:55 am
by ryseely
I need some help on where to start. I looked at the source code and it looks like may script and CSS, but I am not able to find much in the source to extract.

Any suggestions?
Where do I begin?

Thanks!!! :roll:

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 11:05 am
by Support
What exactly do you need to extract from the Google serch result?

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 2:08 pm
by ryseely
The "TEXT SITE" name.

Here is an example. I searched for "pallet" the 1st result was

Pallet - Wikipedia, the free encyclopedia
en.wikipedia.org/wiki/PalletCached - Similar
You +1'd this publicly. Undo
A pallet sometimes called a skid, is a flat transport structure that supports goods in a stable fashion while being lifted by a forklift, pallet jack, front loader or other ...

EUR-pallet - Plastic pallet - 463L master pallet - Pallet crafts


"en.wikipedia.org/wiki/Pallet" is what I need.

Thanks!!! ;)

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 3:06 pm
by Support
ok, so you need the text that's in green then?

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 4:08 pm
by ryseely
en.wikipedia.org/wiki/Pallet

Yes, the text in green.

Thanks!!! 8-)

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 5:24 pm
by Support
ok, here is the script. When you run it, the browser window will come up. Do your search and then close the browser to get the result...

Code: Select all

PerlRegEx = Yes;
Output.Clear;

Link = New(URL);
rx   = New(RegEx);

Link.Location = BrowseTo('www.google.com');

loop
  Link.Get;

  rx.Data = Link.Data;
  rx.Mask = '<cite>.*?</cite>';

  while rx.Match do begin
    lnk = rx.Value - '<[^>]*>';
    Output(lnk);
  end;

  rx.Mask = '<a href="([^"]+)"[^>]*><[^>]*><[^>]*><[^>]*>Next';
  if not rx.Match then Break;

  Link.Location = Link.Fixup(Decode(rx.Value[1]));
end;

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 10:11 pm
by ryseely
Works like a dream.

Thanks for your help!!! :P

Re: Google Search, Results Sites Extraction...

Posted: Thu Mar 08, 2012 10:32 pm
by Support
You are welcome :)