Skip to content

Instantly share code, notes, and snippets.

@levity
Created June 5, 2011 21:14
Show Gist options
  • Save levity/1009426 to your computer and use it in GitHub Desktop.
Save levity/1009426 to your computer and use it in GitHub Desktop.
more mechanize: mass-adjust meetup communication settings
#!/usr/bin/ruby
require 'rubygems'
require 'mechanize'
print "email: "
email = gets.chomp
print "password: "
password = gets.chomp
agent = Mechanize.new
agent.get 'https://secure.meetup.com/login'
agent.page.forms.first.tap do |f|
f.set_fields :email => email, :password => password
f.submit
end
agent.get 'http://www.meetup.com/account/comm/'
links = agent.page.links_with :text => 'Edit communication settings'
links.each do |link|
print "#{link.href}... "
agent.get link.href
agent.page.forms.first.tap do |f|
# no message board updates (for those meetups that have one)
f.checkboxes.detect{|c| c.node[:id] == 'updates'}.tap{|c| c.uncheck if c}
# no event reminders
f.checkbox_with(:name => 'evRemind').uncheck
f.submit
end
puts 'ok'
end
@levity
Copy link
Author

levity commented Sep 22, 2011

to unsubscribe from a meetup group completely:

agent.get "http://www.meetup.com/Some-Group/unsubscribe/"
agent.page.forms.first.submit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment