I writing a little program that should stream a song from soundcloud.. my code is:
import soundcloud
cid="==="
cs="==="
un="==="
pw="==="
client = soundcloud.Client(
client_id=cid,
client_secret=cs,
username=un,
password=pw
)
print "Your username is " + client.get('/me').username
# fetch track to stream
track = client.get('/tracks/293')
# get the tracks streaming URL
stream_url = client.get(track.stream_url, allow_redirects=False)
# print the tracks stream URL
print stream_url.location
It just printing the usernsame, and the track URL It prints something like this:
Your username is '==='
https://ec-media.soundcloud.com/cWHNerOLlkUq.128.mp3?f8f78g6njdj.....
Then, i want to play the MP3 from the URL. I can download it using urllib, but if it is a big file, it would take a lot of time.
What is the best way to stream the MP3? Thanks!!