PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Screen Scraping an Image
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Screen Scraping an Image

Réponse
 
LinkBack Outils de la discussion
Vieux 03/12/2007, 21h10   #1
Sean Kenney
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Screen Scraping an Image

How do you screen scrape an image off of a web page?
  Réponse avec citation
Vieux 03/12/2007, 21h20   #2
Phrogz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Screen Scraping an Image

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.
  Réponse avec citation
Vieux 03/12/2007, 22h25   #3
Robert Citek
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Screen Scraping an Image

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

  Réponse avec citation
Vieux 03/12/2007, 22h37   #4
Sean Kenney
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Screen Scraping an Image

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)
}
}
  Réponse avec citation
Vieux 05/12/2007, 18h25   #5
Vitor Peres
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Screen Scraping an Image

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 }

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12158 seconds with 13 queries