Skip to content

Instantly share code, notes, and snippets.

@wmoxam
Created January 26, 2009 04:40
Show Gist options
  • Select an option

  • Save wmoxam/52707 to your computer and use it in GitHub Desktop.

Select an option

Save wmoxam/52707 to your computer and use it in GitHub Desktop.
require 'open-uri'
def read_zip(io)
gz = Zlib::GzipReader.new(io)
html = gz.read
gz.close
html
end
html = nil
open("http://en.wikipedia.org/wiki/Extrajudicial_killings_and_forced_disappearances_in_the_Philippines") do |doc|
html = doc.content_encoding.include?('gzip') ? read_zip(doc) : doc.read
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment