That will work, thanks!
Dan
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
···
-----Original Message-----
From: Aaron Patterson [mailto:aaron_patterson@speakeasy.net]
Sent: Tuesday, May 30, 2006 12:40 PM
To: ruby-talk ML
Subject: Re: Trying to download files using WWW::MechanizeOn Wed, May 31, 2006 at 03:16:45AM +0900, Berger, Daniel wrote:
> I've gotten this far:
>
> require 'mechanize'
> include WWW
>
> mech = Mechanize.new
> agent = mech.get(url)
>
> page.links.each{ |link|
> p link
> }Try something like this:
require 'rubygems'
require 'mechanize'agent = WWW::Mechanize.new
page = agent.get(ARGV[0])bodies =
page.links.each { |link|
puts "Clicking '#{link.text}'"
bodies << agent.click(link).body
}p bodies
Or even shorter:
agent = WWW::Mechanize.new
bodies =
agent.get(ARGV[0]).links.each { |link|
bodies << agent.click(link).body
}p bodies
--Aaron