Skip to content

Instantly share code, notes, and snippets.

@mitsuhirookuno
Last active August 29, 2015 14:03
Show Gist options
  • Save mitsuhirookuno/7a1a55e1ec8721ae1327 to your computer and use it in GitHub Desktop.
Save mitsuhirookuno/7a1a55e1ec8721ae1327 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'json'
require 'nokogiri'
JSON_FEED_URL = 'http://localhost:4567/'
list = Array.new
open(JSON_FEED_URL) do |json_feed|
json = JSON.parse(json_feed.read)
json['RDF']['item'].each do |item|
doc = Nokogiri::HTML.parse(item['encoded'])
list.push( "<img src='%s' />" % doc.xpath('//img/@src').first.value )
end
end
puts <<"EOS"
<html>
<body>
#{list.join}
</body>
</html>
EOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment