Created
March 25, 2017 16:20
-
-
Save stack-stuck/be2de22b10d746eb30c03215466a52e8 to your computer and use it in GitHub Desktop.
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
#!/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