S
Sean Kenney
How do you screen scrape an image off of a web page?
How do you screen scrape an image off of a web page?
You find the URL of the image (possibly resolving a relative URL
against the absolute URL of the page) and then ask the web server to
send you that file over http.
Or maybe shorter:Here's a script I found at
http://www.rubynoob.com/articles/2006/8/21/how-to-download-files-with-a-ruby-script
require 'net/http'
Net::HTTP.start("static.flickr.com") { |http|
resp = http.get("/92/218926700_ecedc5fef7_o.jpg")
open("fun.jpg", "wb") { |file|
file.write(resp.body)
}
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.