I have to write scripts parsing html pages (e-shops product lists, actually), and get the product names, prices, links to photos, etc.
Usually they have autogenerated pages, so basically page consists of repeating chunks like
<table>
<tr>
<td>........</td>
</tr>
</table>
that have a little differences inside - that differences are names, prices, photos, etc.
Obviously, one have to change parsing repexp every time the page desing or markup changes.
HTML stripping technique doesn't always help, because I have to have image urls and other html information on products.
The best solution would be an algorithm that could find repeating chunks and return the differences they have - that's the actual data I'm digging for.
For example, if there is 20 products on a page, there's 20 similar chunks of code, and their differences are my data.
Maybe there's such CPAN module or smth.
Thanks!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.