Created
June 3, 2017 15:48
-
-
Save ryanckulp/a90a0cb2b935b8178a68855c8943a4c9 to your computer and use it in GitHub Desktop.
fanburst autofollow script
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 'json' | |
require 'curb' | |
# follows artists on fanburst.com using their user_id | |
# confirmed 4.20.17 that 22,300+ profiles exist | |
# artist id can be found via 'data' attribute on a profile's "follow" button | |
COOKIE = 'REDACTED' | |
CSRF_TOKEN = 'REDACTED' | |
def follow_artist(user_id) | |
params = {followed_id: user_id} | |
resp = Curl.post("https://fanburst.com/relationships", params.to_json) do |curl| | |
curl.headers['Content-Type'] = 'application/json' | |
curl.headers['Cookie'] = COOKIE | |
curl.headers['X-csrf-token'] = CSRF_TOKEN | |
end | |
puts resp.status | |
end | |
def unfollow_artist(user_id) | |
params = {followed_id: user_id} | |
resp = Curl.delete("https://fanburst.com/relationships", params.to_json) do |curl| | |
curl.headers['Content-Type'] = 'application/json' | |
curl.headers['Cookie'] = COOKIE | |
curl.headers['X-csrf-token'] = CSRF_TOKEN | |
end | |
puts resp.status | |
end | |
# starting point: note how many followers you have, then add 1 | |
artist_profiles = [] | |
starting_point = 3250 | |
(starting_point...starting_point+650).each {|p| artist_profiles << p} | |
# unfollow profiles followed previously, before following new ones | |
artist_profiles.each do |profile| | |
puts "trying to unfollow artist #{profile}..." | |
unfollow_artist(profile) | |
end | |
artist_profiles.each do |profile| | |
puts "trying to follow artist #{profile}..." | |
follow_artist(profile) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment