Skip to content

Instantly share code, notes, and snippets.

@maca
Created February 11, 2012 09:08
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save maca/1798070 to your computer and use it in GitHub Desktop.
Save maca/1798070 to your computer and use it in GitHub Desktop.
Script to download all Destroy All Software screencasts, account needed
#! /usr/bin/env ruby
# usage:
# $ das_download.rb email password [download_directory]
require 'mechanize'
# gem 'mechanize-progressbar'
email = ARGV[0] or raise('Please provide the email address for your account')
password = ARGV[1] or raise('Please provide the password for your account')
path = ARGV[2] || './'
download = lambda do |url, file|
agent = Mechanize.new
agent.get 'https://www.destroyallsoftware.com/screencasts/users/sign_in'
form = agent.page.forms.first
form['user[email]'] = email
form['user[password]'] = password
form.submit
agent.pluggable_parser.default = Mechanize::Download
agent.get(url).save(file)
end
agent = Mechanize.new
agent.get 'https://www.destroyallsoftware.com/screencasts/catalog'
screencasts = agent.page.search('li.screencast')
while screencast = screencasts.pop
title = screencast.search('a').first.text
url = screencast.search('.download_link > a:first-child').first['href']
index = screencasts.size
file = "#{path}/#{"%03d" % (index + 1)}-#{title.gsub(/\.|:|,/, '').gsub(/\/|\s/, '-').downcase}.mov"
puts "Downloading #{title} - #{index} to go"
next puts 'Already Downloaded' if File.exist? file
download[url, file]
end
@itsgoingd
Copy link

Hacked together another fork https://gist.github.com/itsgoingd/4e6f9b663a825143ebd6997806931e73

@lukeholder
Copy link

Updated @itsgoingd's version in Apr 2021 https://gist.github.com/lukeholder/64f6a3bbc97c050ddfa605fa4d5dff8c

  • Added the episode number to the filename and meta data
  • Cleaned up the title format (squish!)
  • Download as.mp4 extension
  • Removed tags ("Watched", "Free") from episode names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment