//
// more fun with mechanize @
// http://tramchase.com/scrape-myspace-youtube-torrents-for-fun-and-profit
agent = WWW::Mechanize.new agent.get("http://btjunkie.org/") links = agent.page.search('.tor_details tr a') hrefs = links.map { |m| m['href'] }.select { |u| u =~ /\.torrent$/ } # just links ending in .torrent FileUtils.mkdir_p('btjunkie-torrents') # keep it neat hrefs.each { |torrent| filename = "btjunkie-torrents/#{torrent[0].split('/')[-2]}" puts "Saving #{torrent} as #{filename}" agent.get(torrent).save_as(filename) }