Skip to content

Instantly share code, notes, and snippets.

@lolmaus
Created April 21, 2011 11:47
Show Gist options
  • Save lolmaus/934270 to your computer and use it in GitHub Desktop.
Save lolmaus/934270 to your computer and use it in GitHub Desktop.
require 'open-uri'
page = "podcasts"
file_name = page + ".html"
web_page = open("http://pragprog.com/" + page)
output = File.open(file_name, "w")
begin
while line = web_page.gets
output.puts line
end
output.close
rescue Exception
STDERR.puts "Failed to download #{page}: #{$!}"
output.close
File.delete(file_name)
raise
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment