I have a web page. On it are a list of links. Each link downloads a binary (zipped) file and I would like to download them with ruby. For the first part I use mechanize but the part I have trouble with is net:http
So far I have:
agent.page.links_with(:href => /ViewSample/).map {|link| link.click
agent.page.links_with(:href => /DownloadFile/).each do |link|
link=t+link.uri.to_s
uri = URI(link)
puts uri.class
File.open("downloaded_file", "wb") do |f|
f << Net::HTTP.get(uri)
end
end
}
At the moment there are no errors but nothing gets downloaded.
I know the individual uri's are correct as I've checked them in with puts uri
after uri = URI(link)