我的目标是使用Python 2.7.9从soundcloud网址上的soundcloud(例如lil wayne)中的特定艺术家中提取曲目和播放列表。我尝试了从https://github.com/soundcloud/soundcloud-python
获取的以下代码import soundcloud
client = soundcloud.Client(client_id='xxx')
tracks = client.get('/tracks', limit=10)
for track in tracks:
print track.title
app = client.get('/tracks/30709985')
print app.permalink_url
我尝试更改tracks = client.get('lilwayne/tracks', limit=10)
并更改app = client.get('/lilwayne/tracks')
,但我得到以下追溯:
Traceback (most recent call last):
File "/Users/er/Desktop/Soundcloud.py", line 7, in <module>
tracks = client.get('lilwayne/tracks', limit=10)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/soundcloud/client.py", line 133, in _request
return wrapped_resource(make_request(method, url, kwargs))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/soundcloud/request.py", line 148, in make_request
result.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 844, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: https://api.soundcloud.com/lilwayne/tracks?limit=10&client_id=XXX
问题:为了在soundcloud上拉出特定艺术家的曲目,我是否要更改client.get()
的内容或任何建议?