Skip to content

Instantly share code, notes, and snippets.

@robinsloan
Created April 6, 2013 16:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinsloan/5326770 to your computer and use it in GitHub Desktop.
Save robinsloan/5326770 to your computer and use it in GitHub Desktop.
Export IDs of the people you're following on Twitter.
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
TWITTER_USER = "blahblah"
# get these from dev.twitter.com
CONSUMER_KEY = "blahblah"
CONSUMER_SECRET = "blahblah"
OAUTH_TOKEN = "blahblah"
OAUTH_TOKEN_SECRET = "blahblah"
Twitter.configure do |config|
config.consumer_key = CONSUMER_KEY
config.consumer_secret = CONSUMER_SECRET
config.oauth_token = OAUTH_TOKEN
config.oauth_token_secret = OAUTH_TOKEN_SECRET
end
cursor = -1
followings = Twitter.friend_ids(TWITTER_USER,{:cursor=>cursor})
File.open("followings-#{Time.now.to_s.gsub(" ","_")}.txt", 'w') do |f|
f.write followings.ids.to_s
end
puts "ok! saved #{followings.ids.length} followings to file in this directory."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment