Last active
December 15, 2015 11:49
-
-
Save peterhellberg/5255526 to your computer and use it in GitHub Desktop.
A small Ruby script that downloads the free DnD books from RiotMinds.
This file contains hidden or 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
| 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