DevMountain / soundCloud-api

15 stars 73 forks source link

API Key #5

Closed jugendhacker closed 3 years ago

jugendhacker commented 6 years ago

There is now way to get a API key at the moment, right?

phanirithvij2000 commented 6 years ago

@jugendhacker Yeah Did you try using this key given by Devmountain ?

jugendhacker commented 6 years ago

@phanirithvij2000 I don't, because I want my own key!

phanirithvij2000 commented 6 years ago

Inspect the requests on SoundCloud and you'll be able to know your client id

It is also an API key

jugendhacker commented 6 years ago

@phanirithvij2000 really?

phanirithvij2000 commented 6 years ago

Yeah. It's not fully functional but You will be able to access some API methods

I will post some code here after some time

phanirithvij commented 6 years ago

To get your client_id

Just inspect the requests going out in the browser, almost all of them are XHR. So, go to Developer Tools -> Network -> XHR, You'll find API request urls of format

https://api.soundcloud.com/i1/tracks/{SOME_ID}/streams?client_id={YOUR_CLIENT_ID}
or
https://api-v2.soundcloud.com/users/soundcloud:users:{YOUR_USER_ID}/stats/totals/plays?client_id={YOUR_CLIENT_ID}&from=1531144800000&to=1531227600000&app_version=1530785013&app_locale=en

Once you have your client_id

# Usage: client = login()
def login():
   return soundcloud.Client(
      client_id='client_id',
      username="soundcloud_username",
      password="password"
)
client = login()
url = "https://soundcloud.com/strangefruitsmusic/sf006" #ANY SOUNCLOUD TRACK URL
# resolve track URL into track resource
track = client.get('/resolve', url=url)
track_details = track.fields()
comment_details = []
for comment in client.get('/tracks/%d/comments' % track.id):
    comment_details.append(comment.fields())
data = client.get("/tracks/%d/streams" % track.id)
data_details = data.fields()
print(track_details)
print({"data":data_details, "track":track_details, "comments":comment_details})
jugendhacker commented 6 years ago

@phanirithvij but I think this isnt very legal...

jugendhacker commented 6 years ago

But if I want to develope my own application it's illegal, and please stop writing with headers/highlights, it's difficult to read something like your messages...

phanirithvij commented 6 years ago

Illegal it is I'm sorry about my way of explanation

jugendhacker commented 6 years ago

Ok but I want to develope my own application and that for I need a key, I also asked in the SC Forum but no one really answered...