Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created November 16, 2009 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrchrisadams/235594 to your computer and use it in GitHub Desktop.
Save mrchrisadams/235594 to your computer and use it in GitHub Desktop.
This a quick script adapted from a friend to expedite the process of downloaidng mp3 mixtape files on pages
#!/usr/bin/ruby
# This a quick script adapted from a friend to expedite the process of downloading mp3 mixtape files on pages. You can use it to pull down pretty much any file you fancy matching
require 'rubygems'
require 'net/http'
require 'rio'
require 'uri'
# point this script at webpage with files on it, and it'll pull all the mp3 files on the page off:
# the example below will pull down all the mp3 mixtapes on this page:
# mp3_slurp.rb minneapolisfuckingrocks.blogspot.com/2009/01/diplo-remix-collection.html
url = URI.parse(ARGV[0])
body = Net::HTTP.get url
pattern = "/http:\/\/[a-zA-Z0-9_\.\/].mp3{1}/".
links = body.scan(pattern)
links.each do |link|
puts "Downloading #{File.basename(link)}"
rio(link) > rio(File.basename(link))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment