Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open("http://www.hearthpwn.com/guides/2223-journey-to-ungoro-hearthstones-fifth-expansion"))
output = Array.new
doc.xpath('//img[@class="hscard-static"]').each do |card|
tmp = card['data-href'].to_s
url = card['src'].to_s
title = tmp[%r|^.+/.+?-(.+)$|,1]
output.push [title,url]
end
output.each do |card|
puts sprintf("![%s](%s)", card[0], card[1])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment