Skip to content

Instantly share code, notes, and snippets.

@mccxj
Created June 24, 2009 12:11
Show Gist options
  • Save mccxj/135212 to your computer and use it in GitHub Desktop.
Save mccxj/135212 to your computer and use it in GitHub Desktop.
blogbus_login = 'http://www.blogbus.com/'
blogs = 'http://www.blogbus.com/user/?blogid=1477842&mm=Post&aa=Index&page='
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get(blogbus_login)
form = page.form('frmLogin')
form.username="mccxj"
form.password="my_private_password"
form.checkbox_with(:name => 'remember').check
page = agent.submit(form, form.buttons.first)
(1..50).each do |i|
page = agent.get(blogs + i.to_s)
page.links.each do |l|
if l.href =~ /blogid=1477842&mm=Post&aa=Edit/
p l.href
edit_page = agent.click l
edit_form = edit_page.form("EditorForm")
agent.submit(edit_form)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment