Skip to content

Instantly share code, notes, and snippets.

@jerry-tao
Created February 10, 2017 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerry-tao/91dabc2965d143a0b020a0fb966f7486 to your computer and use it in GitHub Desktop.
Save jerry-tao/91dabc2965d143a0b020a0fb966f7486 to your computer and use it in GitHub Desktop.
mercury web parser
require 'rest-client'
require 'htmlentities'
require 'json'
resource = RestClient::Resource.new("https://mercury.postlight.com/parser?url=https://www.ibm.com/developerworks/cn/linux/l-cn-zerocopy1/",headers:{'x-api-key': 'key'})
result = JSON.parse(resource.get.body)
result['content'] = HTMLEntities.new.decode(result['content'])
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment