Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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