Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Scrape torrents on btjunkie (See related posts)

// download all .torrent links on the btjunkie frontpage
// more fun with mechanize @

agent =
links ='.tor_details tr a')
hrefs = { |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}"

You need to create an account or log in to post comments to this site.

Related Posts