Skip to content

Instantly share code, notes, and snippets.

@famuyiwadayo
Forked from robsonke/soundnodeapp.py
Created April 18, 2020 13:59
Show Gist options
  • Save famuyiwadayo/1a961f1dd953c2e09d321357ae252466 to your computer and use it in GitHub Desktop.
Save famuyiwadayo/1a961f1dd953c2e09d321357ae252466 to your computer and use it in GitHub Desktop.
This lets soundnodeapp uses your own client id and eliminates the api limit.
import getpass
import json
import re
import requests
client_id = re.compile(',client_id:"(.*?)"').search(requests.get(re.compile('src="https://a-v2.sndcdn.com/assets/app-.*.js"').search(requests.get('https://soundcloud.com/').text).group()[5:-1]).text).group()[12:-1]
username = raw_input('Username: ')
password = getpass.getpass()
access_token = requests.post('https://sign-in.soundcloud.com/sign-in/password?client_id={}'.format(client_id), data=json.dumps({'client_id': client_id, 'scope': 'fast-connect non-expiring purchase signup upload', 'recaptcha_response': '', 'credentials': {'identifier': username, 'password': password}}), headers={'Content-type': 'application/json'}).json()['session']['access_token']
print 'Client ID: {}'.format(client_id)
print 'Access Token: {}'.format(access_token)
print requests.get('https://api-v2.soundcloud.com/me?client_id={}'.format(client_id), headers={'Authorization': 'OAuth {}'.format(access_token)}).json()
# run this as: python soundcloud.py
# get client id and run this in dev tools of soundnodeapp:
# window.localStorage.scClientId = "fDoItMDbsbZz8dY16ZzARCZmzgHBPotA";
# restart soundnode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment