Last active
November 30, 2016 14:11
-
-
Save rsnorman/7e4b323ef8c3358400cc53e8f4b50c1d to your computer and use it in GitHub Desktop.
Follow Recent Tweet Interactors
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
# RecentInteractors | |
client = WistfulIndie::Twitter::Client.client | |
page = Nokogiri::HTML(open('https://favstar.fm/users/wistfulindie/recent')) | |
interactor_screen_names = page.css('a.fs-avatar').map { |el| el.attr('title').tr('@', '') }.select { |sn| !sn.empty? }.uniq | |
# RecentInteractorFollower | |
interactor_screen_names = interactor_screen_names - TwitterFollow.pluck(:screen_name) | |
interactor_screen_names.each do |screen_name|jk | |
begin | |
puts "Following #{screen_name}" | |
client.follow(screen_name) | |
rescue Twitter::Error::Forbidden | |
# Can't follow yourself | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment