in reply to Extracting raw text from a website

What exactly do you mean with "raw text"? If you want to strip all HTML-markup from the page, try HTML::Strip.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Extracting raw text from a website
by Anonymous Monk on Dec 03, 2009 at 20:36 UTC
    Hi! I mean what the user sees. Or put another way, the text that a "talking browser" would read to me if I were blind. Thanks!
      HTML::Strip will do that for you:
      use strict; use warnings; use LWP::Simple; use HTML::Strip; my $url = "http://www.perlmonks.org"; my $html = get($url); defined $html or die "Can't fetch HTML from: ",$url; my $hs = HTML::Strip->new(); my $clean_text = $hs->parse( $html ); $hs->eof; print $clean_text;
      Deleting the spurious whitespace which this module adds, is left as an exercise for the reader.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      A reply falls below the community's threshold of quality. You may see it by logging in.