Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created April 14, 2013 19:15
Show Gist options
  • Save msonnabaum/5383837 to your computer and use it in GitHub Desktop.
Save msonnabaum/5383837 to your computer and use it in GitHub Desktop.
require "mechanize"
# your email
email = ""
loop do
@agent = Mechanize.new
page = @agent.get "https://secure.hilton.com/en/hhonors/optout/unsubscribe.jhtml"
form = page.form_with id: "nwsltrWidget"
form['/atg/userprofiling/Profile.crm.emailOptOut.email'] = email
confirm_page = form.submit
if confirm_page.at('//h2').inner_text.strip == 'Unsubscribe Confirmed'
puts '"unsubscribed" lol'
else
abort "oops"
end
sleep 10
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment