Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: web scrapin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 11000 of 11509
Post > Topic >>

Re: web scraping

by orasnita@[EMAIL PROTECTED] (Octavian Rasnita) Apr 28, 2008 at 11:28 PM

First search with search.cpan.org for "Finance" without quotes and see if
you can't find a module that downloads the data you want, and if you
don't,
you can use LWP::UserAgent or WWW::Mechanize and regular expressions to do
it.

A very simple example that gets the title of Google's page:

use LWP::Simple;

my $content = get("http://www.google.com/");

my ($title) = $content =~ /<title[^>]*>(.*?)<\/title[^>]*>/gsi;

print $title;

Octavian

----- Original Message ----- 
From: "Rob Dixon" <rob.dixon@[EMAIL PROTECTED]
>
To: <beginners@[EMAIL PROTECTED]
>
Cc: "Alex Goor" <a_goor@[EMAIL PROTECTED]
>
Sent: Monday, April 28, 2008 9:15 PM
Subject: Re: web scraping


> Alex Goor wrote:
>> I was hoping to write a simple program (if that's possible) to open a
>> browser, go to a site, and scrape a piece of information from that
>> site.
>>
>> For example, I was hoping to open a Safari of Firefox browser, go to
>> nyt.com and scrape the Dow Jones Industrial Average which is on the
>> homepage.
>>
>> Does anyone know where I could get an example program that does this
>> kind of thing to teach myself the concepts?
>
> Driving an actual Web browser is awkward and unnecessary unless the page
> you want cannot be handled with a Perl module.
>
> Take a look at WWW::Mechanize and see if it suits your purpose.
>
> Rob
>
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@[EMAIL PROTECTED]
> For additional commands, e-mail: beginners-help@[EMAIL PROTECTED]
> http://learn.perl.org/
>
>
 




 3 Posts in Topic:
web scraping
a_goor@[EMAIL PROTECTED]   2008-04-28 11:03:38 
Re: web scraping
rob.dixon@[EMAIL PROTECTE  2008-04-28 19:15:32 
Re: web scraping
orasnita@[EMAIL PROTECTED  2008-04-28 23:28:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 21:21:24 CDT 2008.