Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Web Scraping on CGI Scripts?

by fraizerangus (Sexton)
on Oct 10, 2011 at 08:38 UTC ( #930554=note: print w/replies, xml ) Need Help??

in reply to Re: Web Scraping on CGI Scripts?
in thread Web Scraping on CGI Scripts?

Hi Corion

Unfortunately I don't have access to the server machine itself, I'm doing it over the internet entirely. I've been using Web::Scraper which works really well with properly formatted HTML but not with CGI. I'm trying to get the URL and name of entries in the table. For example the code I've been using is:

#!/usr/bin/perl use warnings; use strict; use URI; use Web::Scraper; open FILE, ">file.txt" or die $!; # website to scrape my $urlToScrape = ""; # prepare data my $teamsdata = scraper { # we will save the urls from the teams process "tr.cell2> A", 'urls[]' => '@href'; # we will save the team names process "tr.cell2> A", 'teams[]' => 'TEXT'; }; # scrape the data my $res = $teamsdata->scrape(URI->new($urlToScrape));

Please follow the link given in the code and open its page source for an example? best wishes Dan

Replies are listed 'Best First'.
Re^3: Web Scraping on CGI Scripts?
by Corion (Pope) on Oct 10, 2011 at 08:47 UTC

    There is no conceptual difference between "CGI" and "HTML" when they are accessed over HTTP. If Web::Scraper fails, maybe you can tell us how it fails and where.

      Web::Scraper does'nt seem to recgnise the <> tagging in the CGI scripts in the same way as the HTML, if you run the same code on HTML it works but on CGI it can't recognize and process it?

        Most likely whatever browser you use to "save the HTML" reformats the data it receives. Go look at what data exactly Web::Scraper sees, maybe using curl or wget or LWP::Simple::get, and work from that instead of data that was changed by the browser.

        Also learn the difference between "HTML" and "CGI", and learn why it does not apply. It seems to me that by "HTML" you mean "data retrieved from locally saved files", and by "CGI" you mean "data retrieved online over HTTP". You should change the terms you use appropriately.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://930554]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-01-24 00:24 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (199 votes). Check out past polls.