Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Any pure-perl html to text? (Or: missing a perl equivalent to 'lynx -dump')

by davidrw (Prior)
on Oct 15, 2006 at 16:22 UTC ( #578399=note: print w/replies, xml ) Need Help??


in reply to Any pure-perl html to text? (Or: missing a perl equivalent to 'lynx -dump')

WWW::Mechanize has a method for that (it requires that HTML::TreeBuilder is installed as well) ..
my $mech = WWW::Mechanize->new(); $mech->get('http://example.com'); print $mech->content(format => 'text');
If you're not already using WWW::Mechanize for your scraping, i highly recommend it (note it uses LWP underneath)..
Update: added 'print' so that snippet has output
  • Comment on Re: Any pure-perl html to text? (Or: missing a perl equivalent to 'lynx -dump')
  • Download Code

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://578399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2020-10-25 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?