Skip to content

Instantly share code, notes, and snippets.

@uu59
Created September 19, 2012 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save uu59/3750011 to your computer and use it in GitHub Desktop.
Save uu59/3750011 to your computer and use it in GitHub Desktop.
make private all bookmarks on Delicious
# -- coding: utf-8
require "rubygems"
require "grill"
Grill.implant <<-GEM
source :rubygems
gem 'capybara', :require => ["capybara", "capybara/dsl"]
gem "capybara-webkit"
gem "headless"
GEM
module Agent
Capybara.default_driver = :webkit
def self.run(options={}, &block)
h = Headless.new(options)
h.start
agent = Class.new do
include Capybara::DSL
end.new
ObjectSpace.define_finalizer(agent) do
h.destroy
end
agent.instance_eval &block
end
end
images = []
Agent.run do |agent|
login = "https://delicious.com/login"
visit login
within("#login-form") do
fill_in("username", :with => "[USER ID]")
fill_in("password", :with => "[PASSWORD]")
end
find('a.loginSubmit').click
while current_url == login
sleep 0.1
end
puts current_url
find('#allCheck').click
find('a[a="private"]').click
find('a[a="click|confirm"]').click
while (find('p.loading') rescue nil)
sleep 0.1
end
puts :done
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment