1
我写一个小程序,应该从SoundCloud .. 我的码流的歌曲从SoundCloud一首歌:流使用Python API
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
它只是打印usernsame,和轨道URL 它打印这样的东西:
Your username is '==='
https://ec-media.soundcloud.com/cWHNerOLlkUq.128.mp3?f8f78g6njdj.....
然后,我想从URL播放MP3。我可以使用urllib下载它,但如果它是一个大文件,它会花费很多时间。
什么是流的MP3的最佳方式是什么? 谢谢!