Created
June 14, 2011 17:56
-
-
Save dacort/1025451 to your computer and use it in GitHub Desktop.
Twitter Mass Notification Disable
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
client = Grackle::Client.new(:auth => { | |
:type => :oauth, | |
:consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET, | |
:token => TOKEN, :token_secret => TOKEN_SECRET | |
}) | |
users = [] | |
(client.friends.ids?).each_slice(100) do |uids| | |
users |= (client.users.lookup? :user_id => uids.join(',')) | |
end | |
sms_uids = users.select{|u| u.notifications}.collect{|u| u.id} | |
sms_uids.each_slice(100) do |uids| | |
client.lists.members.create_all!( | |
:slug => LIST_SLUG, | |
:owner_screen_name => MY_SCREEN_NAME, | |
:user_id => uids.join(',') | |
) | |
end | |
sms_uids.each do |uid| | |
client.notifications.leave! :user_id => uid | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment