Skip to content

Instantly share code, notes, and snippets.

@soramugi
Created November 29, 2014 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soramugi/6a8de689cbe9e71f56a5 to your computer and use it in GitHub Desktop.
Save soramugi/6a8de689cbe9e71f56a5 to your computer and use it in GitHub Desktop.
tumblrフォロー返し
require 'tumblife'
require 'pp'
Tumblife.configure do |config|
config.consumer_key = ENV['CONSUMER_KEY']
config.consumer_secret = ENV['CONSUMER_SECRET']
config.oauth_token = ENV['OAUTH_TOKEN']
config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']
end
client = Tumblife.client
followers = client.followers(ENV['SITE_URL'], limit: 20, offset: 0)
total_users = followers['total_users']
count = total_users / 20
0.upto(count) do |i|
followers = client.followers(ENV['SITE_URL'], limit: 20, offset: (i * 20)) unless i == 0
followers['users'].each do |user|
unless user['following']
p user['name']
p client.follow(user['url'])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment