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