Created
March 28, 2015 09:04
-
-
Save 45deg/b88e755c69f73f09802c to your computer and use it in GitHub Desktop.
Copy List from the other account (requires twitter gem, and the twitter lists having the same name. )
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 'twitter' | |
puts "Open browser and run below script in Console." | |
puts "$('.app-settings, .access').find('span:not(.heading):lt(2)').map(function(){ return $(this).text() }).toArray().join(':')" | |
print "Source: " | |
source_token = gets.chomp.split(':') | |
print "Target: " | |
target_token = gets.chomp.split(':') | |
print "Name: " | |
name = gets.chomp | |
client_from = Twitter::REST::Client.new do |config| | |
config.consumer_key = source_token[0] | |
config.consumer_secret = source_token[1] | |
config.access_token = source_token[2] | |
config.access_token_secret = source_token[3] | |
end | |
client_to = Twitter::REST::Client.new do |config| | |
config.consumer_key = target_token[0] | |
config.consumer_secret = target_token[1] | |
config.access_token = target_token[2] | |
config.access_token_secret = target_token[3] | |
end | |
list = client_from.list_members(name).to_a.map{|s| s.id } | |
list_sliced = list.each_slice(100).to_a | |
list_sliced.each do |members| | |
client_to.add_list_members(name, members) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment