Created
February 10, 2017 10:30
-
-
Save jerry-tao/91dabc2965d143a0b020a0fb966f7486 to your computer and use it in GitHub Desktop.
mercury web parser
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 '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