在我的rails项目中,我希望使用用户从他的SoundCloud帐户或任何SoundCloud链接提供的歌曲URL获取SoundCloud曲目/歌曲标题,描述,提供者数据。
答案 0 :(得分:1)
您可以使用SoundCloud API - 请参阅SoundCloud URLs:
部分如果您有特定资源的固定链接URL,但需要更多信息,例如ID或其他属性。在这些情况下,您可以使用/resolve端点来提取资源的完整表示。
还有一个使用 Ruby 的例子:
require 'soundcloud'
# create client with your app's credentials
client = Soundcloud.new(:client_id => 'YOUR_CLIENT_ID')
# a permalink to a track
track_url = 'http://soundcloud.com/forss/voca-nomen-tuum'
# resolve track URL into track resource
track = client.get('/resolve', :url => track_url)
# now that we have the track id, we can get a list of comments, for example
client.get("/tracks/#{track.id}/comments").each do |comment|
puts "Someone said: #{comment.body} at #{comment.timestamp}"
end