Skip to content

Instantly share code, notes, and snippets.

View laguiar's full-sized avatar
🏠
Working from home

Luiz Aguiar laguiar

🏠
Working from home
View GitHub Profile
@laguiar
laguiar / gist:122644
Created June 2, 2009 22:44
Get all images from a URL
require 'rubygems'
require 'hpricot'
require 'net/http'
require 'open-uri'
site = "http://www.globo.com"
html = Hpricot.XML(open(site))
images = html.search("//img").each do |img|
img_addr = img.get_attribute("src")
img_addr = site + img_addr if img_addr.slice(0..0) == "/"