From: Sam Kong Date: 2005-05-10T05:05:27+09:00 Subject: Re: How to extract texts from html source? Brian Schr�der wrote: > On 09/05/05, James Britt wrote: > > Sam Kong wrote: > > > Hi, all! > > > > > > Quite often, when I need to read a list of web pages, I download the > > > html sources and save them in a single file like a.html. > > > If they are mostly texts, I open the html using web browser, select all > > > and copy it to an editor and save it. > > > I want to make the process shorter. > > > How can I extract the text from html source? > > > I'm sure there're many parsers for it. > > > What is the most convenient one? > > > > Take a a look at Michael Neumann's WWW::Mechanize > > > > http://www.ntecs.de/blog/Blog/WWW-Mechanize.rdoc > > http://rubyforge.org/frs/?group_id=427&release_id=2014 > > > > Or install the gem > > > > James > > > > > > > > Thanks. > > > Sam > > > > > > > > > . > > > > > > > -- > > > > http://www.ruby-doc.org > > http://www.rubyxml.com > > http://catapult.rubyforge.com > > http://orbjson.rubyforge.com > > http://ooo4r.rubyforge.com > > http://www.jamesbritt.com > > > > > > You don't need ruby for this: > > $ apt-cache show w3m > Package: w3m > [snip] > Description: WWW browsable pager with excellent tables/frames support > w3m is a text-based World Wide Web browser with IPv6 support. > It features excellent support for tables and frames. It can be used > as a standalone file pager, too. > . > * You can follow links and/or view images in HTML. > * Internet message preview mode, you can browse HTML mail. > * You can follow links in plain text if it includes URL forms. > * With w3m-img, you can view image inline. > . > For more information, > see http://sourceforge.net/projects/w3m > > $ w3m -dump http://ruby.brian-schroeder.de/quiz/mazes/ | head > A ruby a day! Oh, thanks. I just realized that even lynx can do that. Regards, Sam > > Ruby Quiz Solutions (Amazing Mazes) > > Amazing Mazes > > For a full description see: (Amazing Mazes on Ruby Quiz Homepage)[http:// > www.rubyquiz.com/quiz31.html] > > Another graph algorithm. Create a maze that is fully connected and has only one > $ > > regards, > > Brian > > -- > http://ruby.brian-schroeder.de/ > > multilingual _non rails_ ruby based vocabulary trainer: > http://www.vocabulaire.org/ | http://www.gloser.org/ | http://www.vokabeln.net/