Skip to content

Instantly share code, notes, and snippets.

@venj
Created January 8, 2011 01:08
Show Gist options
  • Save venj/770401 to your computer and use it in GitHub Desktop.
Save venj/770401 to your computer and use it in GitHub Desktop.
Download pics.
#! /usr/bin/env ruby
# Usage:
# 1. install ruby and wget if you don't have
# 2. gem install nokogiri
# 3. mkdir pics, put this script into it
# 4. ruby batch_down_pics.rb
# (or chmod +x batch_down_pics.rb && ./batch_down_pics.rb)
#
# WARN: 18+ content!
require 'rubygems'
require 'open-uri'
require 'nokogiri'
base_url = 'http://empressofkink.tumblr.com/page/'
(1..111).each do |page|
full_url = base_url + page.to_s
doc = Nokogiri::HTML(open(full_url))
doc.xpath('//div/a/img').each do |img|
system("wget #{img['src']}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment