如何从API获取purchase_url

时间:2014-12-28 22:53:44

标签: soundcloud

我在其中一个曲目中添加了一个购买链接,然后尝试通过API(Ruby包装器)访问它。它始终显示空字段。

更新purchase_url也无效,而其他字段也会更新。

这是我的错误还是做错了什么?

1 个答案:

答案 0 :(得分:0)

您可以发布您的网址吗?我能够通过标准GET请求从REST控制台中检索此信息。

以此网址为例: https://soundcloud.com/maddecent/grandtheft-mobbin-feat

HTTP GET: https://api.soundcloud.com/resolve.json?url=https://soundcloud.com/maddecent/grandtheft-mobbin-feat&client_id=[client_id]

返回:

{
    "status": "302 - Found",
    "location": "https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id]"
}

点击跟踪端点:

HTTP GET: https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id]

返回:

{
    "kind": "track",
    "id": 107686148,
    "created_at": "2013/08/28 17:24:39 +0000",
    "user_id": 14730,
    "duration": 186766,
    "commentable": true,
    "state": "finished",
    "original_content_size": 9678964,
    "last_modified": "2014/12/30 20:37:07 +0000",
    "sharing": "public",
    "tag_list": "Hedspin \"Mad Decent\" Jeffree's Dance Electronic Club Mobbin",
    "permalink": "grandtheft-mobbin-feat",
    "streamable": true,
    "embeddable_by": "all",
    "downloadable": false,
    "purchase_url": "http://smarturl.it/GrandtheftMOB",
    "label_id": null,
    "purchase_title": "Buy on iTunes",
    "genre": "",
    "title": "Grandtheft - Mobbin feat. Hedspin",
    "description": "Buy on iTunes: http://smarturl.it/GrandtheftMOB\r\nBuy on Beatport: http://bit.ly/GrandtheftBP\r\nBuy on Amazon: http://amzn.com/B00F4IFFQM\r\n\r\nRespected as one of the best live Canadian DJs in the game, Grandtheft has taken a break from globetrotting to pack in a HUGE release for Jeffree’s. Along with World Red Bull Thre3style champ and close pal Hedspin, they have made something minimal but fierce with their track “Mobbin.” The build channels the darkness of No Limit Records at its prime while the drop carries the bounce of a screwed and chopped new jack swing track. That, combined with the most menacing synth stab we’ve heard in a while, makes this tune unstoppable.\r\n\r\nWith “Give Me More,” Grandtheft lends us a soulful track that marries a delicious combination trap and dub in the same vein as his popular remix of Keys N Krates’ song “Treat Me Right” released off of Dim Mak. The juxtaposition of the drop is a total WTF moment for any club-goer and we mean that in the best way possible. Grandtheft’s momentum continues to pick up incredible speed with each release, and we don’t see his rise mellowing out anytime soon.\r\n\r\nGrandtheft\r\nSoundcloud: http://www.soundcloud.com/grandtheft\r\nFacebook: http://facebook.com/grandtheftmusic\r\nTwitter: https://twitter.com/grandtheft\r\nInstagram: http://instagram.com/itsgrandtheft\r\nYoutube: http://youtube.com/grandtheftofficial\r\n\r\nHedspin\r\nSoundcloud: https://soundcloud.com/hedspin\r\nFacebook: https://www.facebook.com/djhedspin\r\nTwitter: https://twitter.com/HEDSPIN\r\nInstagram: http://instagram.com/djhedspin",
    "label_name": "Jeffree's",
    "release": "JEFF060",
    "track_type": "",
    "key_signature": "",
    "isrc": "US-Z4V-13-00221",
    "video_url": null,
    "bpm": null,
    "release_year": 2013,
    "release_month": 9,
    "release_day": 17,
    "original_format": "mp3",
    "license": "all-rights-reserved",
    "uri": "https://api.soundcloud.com/tracks/107686148",
    "user": {
        "id": 14730,
        "kind": "user",
        "permalink": "maddecent",
        "username": "Mad Decent",
        "last_modified": "2014/12/18 18:12:40 +0000",
        "uri": "https://api.soundcloud.com/users/14730",
        "permalink_url": "http://soundcloud.com/maddecent",
        "avatar_url": "https://i1.sndcdn.com/avatars-000112599114-5etg3g-large.jpg"
    },
    "permalink_url": "http://soundcloud.com/maddecent/grandtheft-mobbin-feat",
    "artwork_url": "https://i1.sndcdn.com/artworks-000056426845-b40tmr-large.jpg",
    "waveform_url": "https://w1.sndcdn.com/JL8flUq6Vn0x_m.png",
    "stream_url": "https://api.soundcloud.com/tracks/107686148/stream",
    "playback_count": 770622,
    "download_count": 16462,
    "favoritings_count": 16626,
    "comment_count": 489,
    "attachments_uri": "https://api.soundcloud.com/tracks/107686148/attachments",
    "policy": "MONETIZE"
}

购买信息在JSON响应中:

"purchase_url": "http://smarturl.it/GrandtheftMOB",
"purchase_title": "Buy on iTunes",