-
-
Save radar/53f8a67c0a8854b45a2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
require 'ruby-debug' | |
# spambottestingpassword | |
bastards = [108789, 107772, 107926, 108790, 108809] | |
agent = Mechanize.new | |
# Logging in | |
page = agent.get('http://rails.lighthouseapp.com/login') | |
# There's two forms, use the login form not the open id form | |
login_form = page.forms[1] | |
login_form.email = "radarlistener@gmail.com" | |
login_form.password = "spambottestingpassword" | |
page = agent.submit(login_form, login_form.buttons.first) | |
bastards.each do |bastard| | |
page = agent.get("http://rails.lighthouseapp.com/users/#{bastard}") | |
puts "NEXT BASTARD" | |
pp page.title | |
# Get all their ticket comments | |
links = page.links.select { |l| l.href =~ /tickets\/\d+/ }.map(&:href).uniq | |
links.each do |link| | |
numbers = /#ticket-(\d+)-(\d+)/.match(link) | |
page = agent.get("https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/#{numbers[1]}/versions/#{numbers[2]}") | |
delete_form = page.forms.detect { |f| f.buttons.detect { |b| b.value == "Yes, delete this ticket comment." } } | |
agent.submit(delete_form, delete_form.buttons.first) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment