> -----Original Message----- > From: Aaron Patterson [mailto:aaron_patterson / speakeasy.net] > Sent: Tuesday, May 30, 2006 1:00 PM > To: ruby-talk ML > Subject: Re: Trying to download files using WWW::Mechanize > > > Hey Dan. > > On Wed, May 31, 2006 at 03:16:45AM +0900, Berger, Daniel wrote: > > How do I grab a particular file and load it into memory or onto the > > local filesystem? I tried using the 'text' method (based on the > > examples file) but that didn't seem to work for me. > > > > I misread the question the first time, so I'll try again! > The text method helps you match the text displayed. For > example, a url that looks like this: > > Hello World! > > Would be found like this: > > page.links.text('Hello World!').first > > Mechanize returns an array because there could be multiple > links that have that text. You can also use a regular > expression like this: > > page.links.text(/Hello World!/).first > > Or, say you need to find all files whose 'href' ends in > '.csv', you could do this: > > page.links.href(/\.csv$/).each { |link| > puts agent.click(link).body > } > > Hope this helps! Your last post actually led to a solution, but this still helps me as it narrows down the links I have to traverse. Thanks again! 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.