Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
more mechanize
Colin Summers
6/14/2007 1:00:00 AM
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?...
)
pp page
but all I get is:
Thread:
#<WWW::Mechanize::Page
{url
#<URI::HTTP:0x333ef2
URL:
http://dapo.org/forums/archive/index.php?t-229...
}
{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
1 Answer
Aaron Patterson
6/14/2007 2:33:00 AM
0
On Thu, Jun 14, 2007 at 09:59:53AM +0900, Colin Summers wrote:
> 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?...
)
> pp page
>
> but all I get is:
> Thread:
> #<WWW::Mechanize::Page
> {url
> #<URI::HTTP:0x333ef2
> URL:
http://dapo.org/forums/archive/index.php?t-229...
}
> {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/mecha...
--
Aaron Patterson
http://tenderlovem...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
more mechanize
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password