Skip to content

Instantly share code, notes, and snippets.

@callumj
Created June 1, 2011 15:03
Show Gist options
  • Save callumj/1002481 to your computer and use it in GitHub Desktop.
Save callumj/1002481 to your computer and use it in GitHub Desktop.
Grab all CITS3230 pdfs
require 'nokogiri'
require 'open-uri'
root_path = "http://undergraduate.csse.uwa.edu.au/units/CITS3230"
Nokogiri::HTML(open("#{root_path}/schedule.html")).css('a').each { |link| File.open("#{Dir.home}/#{File.basename(link['href'])}", 'wb') {|f| f.write(open("#{root_path}/#{link['href']}").read()) } if link['href'] =~ /\b.+.pdf/ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment