-
-
Save mdeiters/2344010 to your computer and use it in GitHub Desktop.
follow from coderwall leaderboard
This file contains hidden or 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 'bundler/setup' | |
| Bundler.require(:default) if defined?(Bundler) | |
| @config ||= YAML.load_file 'config_twitter.yml' | |
| targets = [ | |
| 'http://coderwall.com/teams/4f27193d973bf0000400029d', | |
| 'http://coderwall.com/teams/4f271946973bf000040004a1', | |
| 'http://coderwall.com/teams/4f271948973bf00004000515', | |
| 'http://coderwall.com/teams/4f271945973bf00004000463', | |
| 'http://coderwall.com/teams/4f5fe57e7d4152000d000002', | |
| 'http://coderwall.com/teams/4f271966973bf00004000ab0', | |
| ] | |
| a = Mechanize.new | |
| users = [] | |
| targets.each do |t| | |
| a.get(t).search('.button.seemore.track').map do |prof| | |
| users << prof['href'].delete('/') | |
| end | |
| end | |
| Twitter.configure do |config| | |
| config.consumer_key = @config['consumer_key'] | |
| config.consumer_secret = @config['consumer_secret'] | |
| config.oauth_token = @config['access_token'] | |
| config.oauth_token_secret = @config['access_secret'] | |
| end | |
| notfounds = [] | |
| users.each do |u| | |
| begin | |
| Twitter.follow(u) if Twitter.user(u) | |
| rescue Twitter::Error::NotFound | |
| notfounds << u | |
| end | |
| end | |
| puts notfounds.join("\n") |
This file contains hidden or 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
| consumer_key: "" | |
| consumer_secret: "" | |
| access_token: "" | |
| access_secret: "" |
This file contains hidden or 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
| source "https://rubygems.org" | |
| gem 'mechanize' | |
| gem 'twitter' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment