Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Last active December 15, 2015 11:49
Show Gist options
  • Select an option

  • Save peterhellberg/5255526 to your computer and use it in GitHub Desktop.

Select an option

Save peterhellberg/5255526 to your computer and use it in GitHub Desktop.
A small Ruby script that downloads the free DnD books from RiotMinds.
require 'open-uri'
require 'nokogiri'
url = 'http://www.riotminds.se/drakar-och-demoner/tiden-innan-trudvang/'
doc = Nokogiri::HTML(open(url))
doc.css('#content .column_left a').map do |a|
title = a.css("img").first.attributes["title"]
href = a.attributes["href"].to_s
cmd = "curl -L #{href} -o \"/tmp/#{title}.pdf\""
puts cmd
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment