Link to home
Create AccountLog in
Avatar of basskozz
basskozz

asked on

Perl Scrape Script

I need a script that will scrape the following site:
http://www.baystateauction.com/auction_list.htm
Information contained with in the "Current Auctions" frame...
and Export to MS Excel file, with the fields :
Status, Date, Time, Address, Notes, Other Notes (postponed info, etc...)

-BassKozz
Avatar of ozo
ozo
Flag of United States of America image

use LWP::Simple;
$_=get 'http://www.baystateauction.com/auction_list.htm';
print qq("$1","$2","$3","$4","$5"\n) while m
{
<table[^<>]*>.*?
        <b>(.*?)</b>.*?
      <b>(.*?)&nbsp;.*?&nbsp;\s*(.*?)</b>.*?
      <p><b>(.*?)<b>(?:<br>([^<>]*?))?<br>.*?</p>.*?
</table>
}xsg;
Avatar of basskozz
basskozz

ASKER

ozo,

It's NOT pulling the Town Name for each listing.
Example of what it is pulling:
Foreclosure Auction/Monday March 7th, 2005/12:00 PM/447 Winslow Gray Road/(THE SALE IS CANCELLED)
Example of what is needed to pull:
Foreclosure Auction/Monday March 7th, 2005/12:00 PM/447 Winslow Gray Road/(THE SALE IS CANCELLED)/So. Yarmouth, MA
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Awsome ozo,
I did some tweaking:
use LWP::Simple;
open OUT, "> BayState.csv" || die "couldn't open output file";
$_=get 'http://www.baystateauction.com/auction_list.htm';
print OUT qq("$1","$2","$3","$4","$5","$6","$7"\n) while m
{
<table[^<>]*>.*?
        <b>(.*?)</b>.*?
      <b>(.*?)&nbsp;.*?&nbsp;\s*(.*?)</b>.*?
      <p><b>(.*?)<b>(?:<br>([^<>]*?))?<br>(.*?)\s*,\s*&nbsp;\s*(.*?)</p>.*?
</table>
}xsg;

Works Great !!!
Thanks
I have another one that I need help on:
https://www.experts-exchange.com/questions/21341458/Perl-Scrape-Script-Excel.html

Maybe instead of just righting the scripts, can you point me in the right direction of a Beginners guide to using PERL & LWP::Simple, so that I can create them on my own.  

Or if you'd rather create them I'd Appreciate it.
Thanks for all your help ozo
-BassKozz
see
perldoc perlre