Created
November 16, 2009 00:14
-
-
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
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
#!/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