更新时间:2023-02-14 21:54:49
您真正想要的是Mechanize :: Download
What you really want is the Mechanize::Download
http://mechanize.rubyforge.org/Mechanize/Download.html
您可以使用这种方式:
require 'mechanize'
agent = Mechanize.new
agent.pluggable_parser.default = Mechanize::Download
agent.get('http://example.com/foo').save('a_file_name')