Created
August 10, 2014 09:04
-
-
Save tborisova/c66b7d97309fae653bde to your computer and use it in GitHub Desktop.
Simple ruby script to download pdf files and save it to a folder
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
require 'open-uri' | |
require 'yaml' | |
config = YAML.load_file("#{ARGV[0]}") | |
(1..14).each do |lecture_number| | |
File.open("#{config['folder_to_save']}/lecture_#{lecture_number}.pdf", "wb") do |file| | |
filename = config['filename'].gsub('?lecture_number?', lecture_number.to_s) | |
file.write open("#{config['path']}/#{filename}").read | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment