Created
September 25, 2012 23:15
-
-
Save cogumm/3785020 to your computer and use it in GitHub Desktop.
Feed de imagens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'hpricot' | |
require 'open-uri' | |
html = '<html><head><title>Feed de imagens</title>' | |
html += '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"></meta></head>' | |
html += '<link rel="stylesheet" href="http://passets-lt.pinterest.com/css/pinboard_759c5bb3.css" type="text/css" media="all"/>' | |
html += '<body><h1>Feed de imagens</h1>' | |
doc = Hpricot open('http://pinterest.com/cogumm/nerd/') | |
doc.search 'img' do |img| | |
img['src'] = "#{img['src']}"# unless img['src'].include?('submarino.com.br') | |
html += img.to_s | |
end | |
html += '</body></html>' | |
File.open('Imagens.html', 'w') { |file| file << html } | |
# system 'explorer Imagens.html' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment