more mechanize

C

Colin Summers

Okay, I managed to get mechanize to login for me. Now I am pulling
down a vBulletin page which has a thread on it:

# pull down a thread
puts "Thread:\n"
page = agent.get('http://dapo.org/forums/archive/index.php?t-2293.html?pda=1')
pp page

but all I get is:
Thread:
#<WWW::Mechanize::page
{url
#<URI::HTTP:0x333ef2
URL:http://dapo.org/forums/archive/index.php?t-2293.html>}
{meta}
{title
"Alternator failure For Real This Time [Archive] - Diamond Aircraft
Pilots/Owners Organization"}
{iframes}
{frames}
{links
#<WWW::Mechanize::Link
"Diamond Aircraft Pilots/Owners Organization"
"index.php">
#<WWW::Mechanize::Link "General" "index.php?f-1.html">
#<WWW::Mechanize::Link "Discussions" "index.php?f-4.html">
#<WWW::Mechanize::Link "PDA" "index.php?pda=1">
#<WWW::Mechanize::Link
"Alternator failure For Real This Time"
"http://www.dapo.org/forums/showthread.php?t=2293">}
{forms}>



It's cool that I have a data structure for the links, but, um, where's
the text of the page? That's the stuff I *want*.

Thanks.

--Colin
 
A

Aaron Patterson

Okay, I managed to get mechanize to login for me. Now I am pulling
down a vBulletin page which has a thread on it:

# pull down a thread
puts "Thread:\n"
page =
agent.get('http://dapo.org/forums/archive/index.php?t-2293.html?pda=1')
pp page

but all I get is:
Thread:
#<WWW::Mechanize::page
{url
#<URI::HTTP:0x333ef2
URL:http://dapo.org/forums/archive/index.php?t-2293.html>}
{meta}
{title
"Alternator failure For Real This Time [Archive] - Diamond Aircraft
Pilots/Owners Organization"}
{iframes}
{frames}
{links
#<WWW::Mechanize::Link
"Diamond Aircraft Pilots/Owners Organization"
"index.php">
#<WWW::Mechanize::Link "General" "index.php?f-1.html">
#<WWW::Mechanize::Link "Discussions" "index.php?f-4.html">
#<WWW::Mechanize::Link "PDA" "index.php?pda=1">
#<WWW::Mechanize::Link
"Alternator failure For Real This Time"
"http://www.dapo.org/forums/showthread.php?t=2293">}
{forms}>



It's cool that I have a data structure for the links, but, um, where's
the text of the page? That's the stuff I *want*.

Try this:

puts page.body

Hope that helps! Also, make sure to add yourself to the mechanize
mailing list. You will probably get more prompt responses. :)

http://rubyforge.org/mailman/listinfo/mechanize-users
 

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,261
Messages
2,571,308
Members
47,976
Latest member
AlanaKeech

Latest Threads

Top