How do you screen scrape an image off of a web page?
On Dec 3, 2:10 pm, Sean K. [email protected] wrote:
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.
On Dec 3, 2007 3:24 PM, Phrogz [email protected] wrote:
On Dec 3, 2:10 pm, Sean K. [email protected] wrote:
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.
I suspect Sean is asking, what’s the ruby way of doing a wget?
For example:
wget http://www.ruby-lang.org/images/logo.gif
Regards,
- Robert
On Dec 3, 2007 8:39 PM, Sean K. [email protected] wrote:
}
Or maybe shorter:
require ‘open-uri’
open(‘image.jpg’, ‘wb’) {|f| f << open(’
Website Domain Names, Online Stores & Hosting - Domain.com’).read }
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)
}
}