|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How do you screen scrape an image off of a web page?
|
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Dec 3, 2:10 pm, Sean Kenney <skenne...@gmail.com> 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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Dec 3, 2007 3:24 PM, Phrogz <phrogz@mac.com> wrote:
> On Dec 3, 2:10 pm, Sean Kenney <skenne...@gmail.com> 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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Here's a script I found at http://www.rubynoob.com/articles/200...-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) } } |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Note: parts of this message were removed by the gateway to make it a legal Usenet post.
On Dec 3, 2007 8:39 PM, Sean Kenney <skenney26@gmail.com> wrote: > Here's a script I found at > http://www.rubynoob.com/articles/200...-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) > } > } > > Or maybe shorter: require 'open-uri' open('image.jpg', 'wb') {|f| f << open(' http://www.domain.com/image.jpg').read } |
|
![]() |
| Outils de la discussion | |
|
|