Hpricot parsing problems

?

-- --

Hi,

I would like to get only post content of forum page without any banners
etc.

I made short code to make this. The problem is that Hpricot functions
doesn't return any content. Page loading works but parsing not and file
is empty.
I'm using Windows Vista and Ruby-186-27.

require 'rubygems'
require 'hpricot'
require 'open-uri'

doc =
Hpricot(open('http://forumserver.twoplustwo.com/38/omaha-high/i-can-only-stack-off-nuts-flop-402653/'))

content = (doc/"posts").text

aFile = File.new("c:\\content.html", "w")
aFile.write(content)
aFile.close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top