Skip to content

Instantly share code, notes, and snippets.

@ryanckulp
Created June 3, 2017 16:04
  • 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/7435616ae2e92843d63911e45ff636be to your computer and use it in GitHub Desktop.
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