Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
soundcloud autofollow strategy
require 'json'
require 'curb'
# TODO: find artist IDs for a genre relevant to me, ie acoustic rock
BASE_URL = 'https://api-v2.soundcloud.com/me'
FOLLOWINGS = '/followings/'
CLIENT_ID = 'REDACTED'
ACCESS_TOKEN = 'REDACTED'
def follow(user_id)
resp = Curl.post(BASE_URL + FOLLOWINGS + "#{user_id}?client_id=#{CLIENT_ID}&app_version=#{Time.now.to_i}") do |http|
http.headers['Accept'] = 'application/json'
http.headers['Authorization'] = "OAuth #{ACCESS_TOKEN}"
end
puts resp.status
end
user_ids.each do |user|
puts "trying to follow user_id: #{user}"
follow(user)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.