Created
July 17, 2009 20:21
-
-
Save 19WAS85/149258 to your computer and use it in GitHub Desktop.
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 'hpricot' | |
require 'open-uri' | |
html = '<html><head><title>Agora no Globo.com</title>' | |
html += '<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></head>' | |
html += '<body><h1>Agora</h1><h2>no Globo.com</h2>' | |
doc = Hpricot open('http://www.globo.com') | |
doc.search 'img' do |img| | |
img['src'] = "http://www.globo.com#{img['src']}" unless img['src'].include?('globo.com') | |
html += img.to_s | |
end | |
html += '</body></html>' | |
File.open('Agora.html', 'w') { |file| file << html } | |
# system 'explorer Agora.html' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment