Dear Monks,

I am looking for a way to extract links from html documents. Have been working with HTML::Parser and HTML::LinkExtor, which do fine for what they do, however, I am finding that the list of links they parse is incomplete. For example, the links found in:
<style> background: url('images/bg_content.jpg') </style> <style type="text/css" media="screen">@import "../style.css";</style> <script type="text/javascript"> ... s1.addParam("flashvars","file=testmovie.flv&image=../media/flash/previ +ews/testmovie_prvw.jpg"); ... </script>
are ignored.

If someone can either:

point out what I am missing in order to use HTML::LinkExtor or HTML::Parser the way I want.

suggest another module that they know to be more robust (so I don't have to keep trying them all)

point me to a resource that would provide a list of all possible situations in an HTML document in which a link can occur (whether strictly standard or quirksmode), in which I can write my own.

I will post code if desired, but didn't feel it was necessary to for the question as such.

In reply to More robust link finding than HTML::LinkExtor/HTML::Parser? by Allasso

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.