Created
November 29, 2014 04:21
-
-
Save soramugi/6a8de689cbe9e71f56a5 to your computer and use it in GitHub Desktop.
tumblrフォロー返し
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 '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