Skip to content

Instantly share code, notes, and snippets.

@ryanckulp
Created June 3, 2017 15:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ryanckulp/a90a0cb2b935b8178a68855c8943a4c9 to your computer and use it in GitHub Desktop.
fanburst autofollow script
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