Skip to content

Instantly share code, notes, and snippets.

@sbauch
Created January 12, 2015 17:20
Show Gist options
  • Save sbauch/4a272c11644e3943438b to your computer and use it in GitHub Desktop.
Save sbauch/4a272c11644e3943438b to your computer and use it in GitHub Desktop.
Twitter List => Custom Audience
require 'twitter'
require 'csv'
handle = ARGV[0]
list = ARGV[1]
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR KEY"
config.consumer_secret = "YOUR SECRET"
config.access_token = "YOUR ACCESS TOKEN"
config.access_token_secret = "YOUR ACCESS TOKEN SECRET"
end
list = client.list_members(handle, list, {:limit => 5000})
CSV.open("audience.csv", "w") do |csv|
list.each do |u|
csv << [u.id.to_s, u.name]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment