音乐API调用以及分析(以酷狗音乐为例)

音乐排行榜列表:

                   音乐API调用以及分析(以酷狗音乐为例)_第1张图片

接口地址:

      http://m.kugou.com/rank/list&json=true

请求方式:Get 

返回数据:(这里本编使用只截取了5条数据)

{
    "JS_CSS_DATE": 20130320,
    "kg_domain": "http://m.kugou.com",
    "src": "http://downmobile.kugou.com/promote/package/download/channel=6",
    "fr": null,
    "ver": "v3",
    "rank": {
        "total": 26,
        "list": [
            {
                "rankid": 6666,
                "id": 1,
                "intro": "数据来源:酷狗\r\n排序方式:按歌曲搜索播放量的涨幅排序\r\n更新周期:每天",
                "album_img_9": "http://imge.kugou.com/stdmusic/{size}/20191113/20191113103427760878.jpg",
                "banner7url": "http://imge.kugou.com/mcommon/{size}/20190906/20190906162522894877.jpg",
                "jump_title": "",
                "rankname": "酷狗飙升榜",
                "isvol": 1,
                "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175722740417.png",
                "img_9": "",
                "classify": 1,
                "imgurl": "http://imge.kugou.com/mcommon/{size}/20190906/20190906162520714932.jpg",
                "update_frequency": "每天",
                "jump_url": "",
                "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20190214/20190214100333414437.jpg",
                "ranktype": 2,
                "custom_type": 0,
                "issue": 326
            },
            {
                "rankid": 8888,
                "id": 2,
                "intro": "数据来源:酷狗\r\n排序方式:按每日歌曲播放总量排序",
                "album_img_9": "http://imge.kugou.com/stdmusic/{size}/20191028/20191028175705547707.jpg",
                "banner7url": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122516438289.jpg",
                "jump_title": "",
                "rankname": "酷狗TOP500",
                "isvol": 1,
                "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175730485341.png",
                "img_9": "",
                "classify": 1,
                "imgurl": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122513972113.jpg",
                "update_frequency": "每天",
                "jump_url": "",
                "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20181019/20181019122517263545.jpg",
                "ranktype": 2,
                "custom_type": 0,
                "issue": 325
            },
            {
                "rankid": 37361,
                "id": 227,
                "intro": "数据来源:浮浮雷达(千万用户的识曲选择,遛街刷抖必备)和酷狗听歌识曲。\r\n排序方式:过去7天识别最多的top100首歌曲,告诉你时下最热歌曲。\r\n更新周期:周一至周五每天",
                "album_img_9": "http://imge.kugou.com/stdmusic/{size}/20181228/20181228141741895743.jpg",
                "banner7url": "http://imge.kugou.com/mcommon/{size}/20190808/20190808200003312447.jpg",
                "jump_title": "",
                "rankname": "酷狗雷达榜",
                "isvol": 1,
                "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175741530197.png",
                "img_9": "",
                "classify": 1,
                "imgurl": "http://imge.kugou.com/mcommon/{size}/20190808/20190808200002300015.jpg",
                "update_frequency": "工作日",
                "jump_url": "",
                "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20190808/20190808200005885980.jpg",
                "ranktype": 1,
                "custom_type": 0,
                "issue": 82
            },
            {
                "rankid": 23784,
                "id": 65,
                "intro": "数据来源:酷狗网络类歌曲\r\n排序方式:按歌曲搜索播放一周总量排序\r\n更新周期:周一",
                "album_img_9": "http://imge.kugou.com/stdmusic/{size}/20191028/20191028175705547707.jpg",
                "banner7url": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122442518606.jpg",
                "jump_title": "",
                "rankname": "网络红歌榜",
                "isvol": 1,
                "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175751510685.png",
                "img_9": "",
                "classify": 1,
                "imgurl": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122440628627.jpg",
                "update_frequency": "周一",
                "jump_url": "",
                "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20181019/20181019122444129869.jpg",
                "ranktype": 1,
                "custom_type": 0,
                "issue": 46
            },
            {
                "rankid": 24971,
                "id": 109,
                "intro": "数据来源:酷狗DJ类歌曲\r\n排序方式:按歌曲搜索播放一周总量排序\r\n更新周期:周三",
                "album_img_9": "http://imge.kugou.com/stdmusic/{size}/20191101/20191101192608684195.jpg",
                "banner7url": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122333384421.jpg",
                "jump_title": "",
                "rankname": "DJ热歌榜",
                "isvol": 1,
                "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175759623740.png",
                "img_9": "",
                "classify": 1,
                "imgurl": "http://imge.kugou.com/mcommon/{size}/20181019/20181019122331572959.jpg",
                "update_frequency": "周三",
                "jump_url": "",
                "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20181019/20181019122335144078.jpg",
                "ranktype": 1,
                "custom_type": 0,
                "issue": 48
            }
        ]
    },
    "__Tpl": "rank/list.html"
}

排行版分类歌曲列表

                     音乐API调用以及分析(以酷狗音乐为例)_第2张图片

接口地址:

    http://m.kugou.com/rank/info/?rankid=6666&page=1&json=true

请求方式:Get​​​​​​​ 

参数说明:rankid 排行榜分类下id json 返回类型

         音乐API调用以及分析(以酷狗音乐为例)_第3张图片

返回数据:

{
    "JS_CSS_DATE": 20130320,
    "kg_domain": "http://m.kugou.com",
    "src": "http://downmobile.kugou.com/promote/package/download/channel=6",
    "fr": null,
    "ver": "v3",
    "info": {
        "rankid": 6666,
        "id": 1,
        "intro": "数据来源:酷狗\r\n排序方式:按歌曲搜索播放量的涨幅排序\r\n更新周期:每天",
        "album_img_9": "",
        "banner7url": "http://imge.kugou.com/mcommon/{size}/20190906/20190906162522894877.jpg",
        "jump_title": "",
        "rankname": "酷狗飙升榜",
        "isvol": 1,
        "banner_9": "http://imge.kugou.com/mcommon/{size}/20190909/20190909175722740417.png",
        "img_9": "",
        "classify": 1,
        "imgurl": "http://imge.kugou.com/mcommon/{size}/20190906/20190906162520714932.jpg",
        "update_frequency": "每天",
        "jump_url": "",
        "bannerurl": "http://imge.kugou.com/mcommonbanner/{size}/20190214/20190214100333414437.jpg",
        "ranktype": 2,
        "custom_type": 0,
        "issue": 325
    },
    "songs": {
        "total": 5,
        "page": 1,
        "pagesize": 30,
        "timestamp": 1574399561,
        "list": [
            {
                "pay_type_320": 0,
                "m4afilesize": 0,
                "price_sq": 0,
                "first": 0,
                "filesize": 4037239,
                "bitrate": 128,
                "trans_param": {
                    "cid": 80842130,
                    "pay_block_tpl": 1,
                    "musicpack_advance": 0,
                    "display_rate": 0,
                    "display": 0
                },
                "price": 0,
                "inlist": 1,
                "old_cpy": 1,
                "fail_process_sq": 0,
                "pay_type": 0,
                "topic_url": "",
                "fail_process_320": 0,
                "pkg_price": 0,
                "feetype": 0,
                "filename": "郭力 - 没有什么了不起",
                "price_320": 0,
                "extname": "mp3",
                "hash": "944980C9FA6E6FA5A359AC487570B2C6",
                "mvhash": "",
                "topic_url_320": "",
                "privilege": 0,
                "album_audio_id": 233368010,
                "addtime": "2019-11-22 10:15:04",
                "pkg_price_320": 0,
                "recommend_reason": "",
                "rp_type": "audio",
                "pkg_price_sq": 0,
                "audio_id": 62890791,
                "320filesize": 10092841,
                "rp_publish": 1,
                "has_accompany": 1,
                "topic_url_sq": "",
                "320privilege": 0,
                "isfirst": 0,
                "album_id": "33233727",
                "fail_process": 0,
                "320hash": "63264150C7585985978B0C2DA3587382",
                "sqhash": "F4560CFDBED41B92FEFA875869E78521",
                "remark": "没有什么了不起",
                "pay_type_sq": 0,
                "duration": 252,
                "sqprivilege": 0,
                "sqfilesize": 28343054,
                "issue": 326
            }
        ]
    },
    "pagesize": 30,
    "__Tpl": "rank/info.html"
}

如果想要播放某首音乐,请随本编继续完成以下API的调用和处理:

获取hash值进行拼接(带歌词)

接口地址:

     http://www.kugou.com/yy/index.php?r=play/getdata&hash=913D1AFA9D14FD3862C861E9F6FBA5F1

请求方式:Get 

参数说明:

hash是音乐json中的 hash,每首歌曲都有自己的hash值

如图显示:

                      音乐API调用以及分析(以酷狗音乐为例)_第4张图片

返回数据:

{
    "status":1,
    "err_code":0,
    "data":{
        "hash":"913D1AFA9D14FD3862C861E9F6FBA5F1",
        "timelength":231758,
        "filesize":3708850,
        "audio_name":"孙小宝 - 比上不足比下有余",
        "have_album":1,
        "album_name":"比上不足比下有余",
        "album_id":"32277290",
        "img":"http://imge.kugou.com/stdmusic/20191030/20191030195148610488.jpg",
        "have_mv":0,
        "video_id":0,
        "author_name":"孙小宝",
        "song_name":"比上不足比下有余",
        "lyrics":"[id:$00000000]
[ar:孙小宝]
[ti:比上不足比下有余]
[by:]
[hash:913d1afa9d14fd3862c861e9f6fba5f1]
[al:]
[sign:]
[qq:]
[total:231758]
[offset:0]
[00:00.86]孙小宝 - 比上不足比下有余
[00:02.52]作词:汇丰、叶桐
[00:03.74]作曲:王家军
[00:04.65]编曲:周迪
[00:05.41]出品人:叶存利、谷友斌
[00:10.32]你坐着轿嘿我骑着驴
[00:14.93]怎么觉得和你就不是一个级
[00:19.48]真想狠狠的抽一顿自己
[00:24.05]回头一看还有走着滴
[00:28.66]半夜睡不着哇
[00:30.72]我问问自己
[00:33.16]活着是为了风还是为了雨
[00:37.75]偷偷笑出了声啊
[00:39.87]我笑破肚皮
[00:42.35]原来生活就是自己爱自己
[00:49.22]比上不足我比下有余
[00:53.78]拥有的一切值得我珍惜
[00:58.44]烦恼是心态
[01:00.56]快乐是自己
[01:02.89]真实的自己才是最帅气
[01:07.49]比上不足我比下有余
[01:12.03]拥有的生活值得更努力
[01:16.64]面子是心态
[01:18.87]里子是魄力
[01:21.14]真实的自己才最帅气
[01:44.00]你坐着轿嘿我骑着驴
[01:48.67]怎么觉得和你就不是一个级
[01:53.20]真想狠狠地抽一顿自己
[01:57.70]回头一看还有走着滴
[02:02.34]半夜睡不着哇
[02:04.29]我问问自己
[02:06.87]活着是为了风还是为了雨
[02:11.48]偷偷笑出了声啊
[02:13.56]我笑破肚皮
[02:16.08]原来生活就是自己爱自己
[02:22.98]比上不足我比下有余
[02:27.48]拥有的一切值得我珍惜
[02:32.11]烦恼是心态
[02:34.28]快乐是自己
[02:36.65]真实的自己才最帅气
[02:41.19]比上不足我比下有余
[02:45.74]拥有的生活值得更努力
[02:50.36]面子是心态
[02:52.53]里子是魄力
[02:54.86]真实的自己才最帅气
[02:59.45]比上不足我比下有余
[03:04.10]拥有的一切值得我珍惜
[03:08.66]烦恼是心态
[03:10.83]快乐是自己
[03:13.06]真实的自己才是最帅气
[03:17.70]比上不足我比下有余
[03:22.35]拥有的生活值得更努力
[03:26.80]面子是心态
[03:29.13]里子是魄力
[03:31.45]真实的自己才最帅气
[03:35.93]真实的自己才最帅气
",
        "author_id":"2484",
        "privilege":0,
        "privilege2":"0",
        "play_url":"https://webfs.yun.kugou.com/201911221458/6e27b16addf6d92eba55859cd9cbbee1/G177/M07/15/1D/kZQEAF25CYaAQ3VXADiXsirUw0o130.mp3",
        "authors":[
            {
                "author_id":"2484",
                "sizable_avatar":"http://singerimg.kugou.com/uploadpic/softhead/{size}/20191031/20191031070109186826.jpg",
                "is_publish":"1",
                "author_name":"孙小宝",
                "avatar":"http://singerimg.kugou.com/uploadpic/softhead/400/20191031/20191031070109186826.jpg"
            }
        ],
        "is_free_part":0,
        "bitrate":128,
        "audio_id":"62171445",
        "play_backup_url":"https://webfs.cloud.kugou.com/201911221458/7ebb3a63763df1ae9a4f199cf00611f9/G177/M07/15/1D/kZQEAF25CYaAQ3VXADiXsirUw0o130.mp3"
    }
}

接着就是在歌曲详细json中拿到play_url(带歌词)进行播放

这里本编只用来分析接口故直接在浏览器中打开,具体的请自己根据自己情况去Json中拿参数在自己的产品中进行显示就行。

音乐API调用以及分析(以酷狗音乐为例)_第5张图片

 

接着分析其他接口(下面本编就返回结果不一一说明了所以不够详细都以截图代替,可以自己在postMan中测试接口就行): 

音乐新歌榜

接口地址:

 http://m.kugou.com/?json=true

请求方式:Get

返回数据:

                          音乐API调用以及分析(以酷狗音乐为例)_第6张图片

音乐歌单 

请求地址:

http://m.kugou.com/plist/index&json=true

返回数据 :

                          音乐API调用以及分析(以酷狗音乐为例)_第7张图片

歌手分类

请求地址:

http://m.kugou.com/singer/class&json=true

返回数据:

          音乐API调用以及分析(以酷狗音乐为例)_第8张图片

歌手分类下面的歌手列表 

  接口地址:

http://m.kugou.com/singer/list/calssid?json=true

 参数说明:

       这里的calssid替换成歌手分类的json里面的classid

 返回数据:

                 音乐API调用以及分析(以酷狗音乐为例)_第9张图片

搜索歌曲

接口地址:

http://mobilecdn.kugou.com/api/v3/search/song?format=json&keyword=你的答案&page=1&pagesize=20&showtype=1

请求方式:get

参数说明:

keyword = 要搜索的值

page = 页数(可选)

pagesize = 一页多少条(可选)

返回结果:

音乐API调用以及分析(以酷狗音乐为例)_第10张图片

 

热门搜索列表

接口地址:

http://mobilecdn.kugou.com/api/v3/search/hot?format=json

请求方式:get

返回数据:

                  音乐API调用以及分析(以酷狗音乐为例)_第11张图片

本编声明:只用作学习研究API的调用和API的分析,请勿将以上接口用来商业推广以及其他获利用途,以上接口如有侵权请联系本编进行删除或修改。 

你可能感兴趣的:(API)