Mango Monks,

Looking for a good, simple, quick to get up and running, module to scrape some data from a table in a web page.

The url is basic, no authentication.

The table looks like:

City 1Cloudy-5°C
City 2Cloudy-10°C
City 3Light Snow1°C
City 4Fog Depositing Ice-11°C

<table width="100%" border=1 cellspacing="1" cellpadding="1"> <TR valign="top" BGCOLOR=#FFFFFF> <td align="top"><a href='/forecast/city.html?1'>City 1</a></td><td now +rap align="top">Cloudy</td><td nowrap align="right">-5&deg;C</td></tr +> <TR valign="top" BGCOLOR=#EEF5EE> <td align="top"><a href='/forecast/city.html?2'>City 2</a></td><td now +rap align="top">Cloudy</td><td nowrap align="right">-10&deg;C</td></t +r> <TR valign="top" BGCOLOR=#FFFFFF> <td align="top"><a href='/forecast/city.html?3'>City 3</a></td><td now +rap align="top">Light Snow</td><td nowrap align="right">1&deg;C</td>< +/tr> <TR valign="top" BGCOLOR=#EEF5EE> <td align="top"><a href='/forecast/city.html?4'>City 4</a></td><td now +rap align="top">Fog Depositing Ice</td><td nowrap align="right">-11&d +eg;C</td></tr> </table>
And I want to scrape off the city names, conditions, temperature. I can count on the columns always being in the same order.

Not hard to write a custom parser, but if thee's a module out there ideally suited to this kind of thing, that'd be preferable.

Thanks.





Forget that fear of gravity,
Get a little savagery in your life.

In reply to Best module to scrape tabular data fram web pages? by punch_card_don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.