酷狗音乐-最新接口签名
闲着无聊爬了一下酷狗的接口,环境已经补完过了,可以直接执行签名,只是测试了搜索
和歌曲详情
接口,
其他接口没测试。完整的代码放在压缩文件里面,提供了打包后的exe
可执行文件以及Restful Api
接口。
默认端口8080
经过测试,收费的歌曲只能播放片段,如果是会员可以登录,携带cookie应该就能获取完整音乐。源文件以及打包后的可执行文件在此贴底部。
核心代码
使用js vm 执行签名代码,返回签名结果
func (k *KuGouSign) SignQuery(queryMap map[string]any) (query string, err error) {
jsonStr, err := json.Marshal(&queryMap)
if err != nil {
return "", err
}
k.vm.Set("vm_ops", string(jsonStr))
val, err := k.vm.Run(k.signFuncStr)
if err != nil {
return "", err
}
valStr, err := val.ToString()
if err != nil {
return "", err
}
return valStr, nil
}
接口
名称 |
接口 |
示例 |
查询歌曲 |
/search |
/search?keyword=张杰&page=1&page_size=1 |
获取歌曲详情 |
/info |
/info?sign_id=xxx |
示例-搜索
请求: http://localhost:8080/search?keyword=张杰&page_size=1
{
"error_msg": "",
"error_code": 0,
"data": {
"pagesize": 1,
"page": 1,
"total": 408,
"lists": [
{
"SQFileHash": "CD146A90B1AE77BDE3F25198EE988555",
"PublishTime": "",
"Audioid": 78323781,
"SuperDuration": 0,
"OldCpy": 0,
"PublishAge": 255,
"HQBitrate": 320,
"PayType": 3,
"TagContent": "TOP500 第207名",
"Accompany": 1,
"TagDetails": [
{
"content": "TOP500 第207名",
"rankid": 8888,
"type": 4,
"version": 1
}
],
"FoldType": 0,
"HQPrivilege": 10,
"TopicRemark": "",
"OriOtherName": "",
"ShowingFlag": 0,
"Source": "",
"ResDuration": 221,
"SQFileSize": 28912458,
"ResFileHash": "EECA127CB0FAB142E0026AE5BE30220C",
"HQDuration": 221,
"top": 0,
"Image": "http://imge.kugou.com/stdmusic/{size}/20221205/20221205230912991735.jpg",
"HQPayType": 3,
"M4aSize": 0,
"SQPkgPrice": 1,
"UploaderContent": "",
"FileSize": 3545325,
"IsOriginal": 0,
"FileHash": "17B11C65674378CA43995537331E1D9C",
"EAlbumID": "mzgun9a",
"MvTrac": 3,
"Type": "audio",
"Grp": [],
"SQPrice": 200,
"Publish": 1,
"ExtName": "mp3",
"Price": 200,
"SingerName": "张杰",
"Res": {
"PkgPrice": 1,
"Privilege": 10,
"PayType": 3,
"FailProcess": 4,
"Price": 200
},
"AlbumName": "听!我们的歌",
"Category": 1,
"SuperExtName": "",
"FileName": "张杰 - 天下",
"OtherName": "",
"SongName": "天下",
"ASQPrivilege": 10,
"AudioCdn": 0,
"SourceID": 0,
"SQDuration": 221,
"HQPkgPrice": 1,
"Auxiliary": "",
"PkgPrice": 1,
"Singers": [
{
"name": "张杰",
"ip_id": 0,
"id": 3539
}
],
"SQPayType": 3,
"TopID": 0,
"Uploader": "",
"HQPrice": 200,
"Suffix": "",
"HQFailProcess": 4,
"mvdata": [
{
"id": "3120084",
"trk": "3",
"hash": "AC2FB481F41DBDCA5CF4890B26246226",
"typ": 0
}
],
"SQFailProcess": 4,
"SongLabel": "",
"HiFiQuality": 3,
"ID": "268299573",
"SingerId": [
3539
],
"Privilege": 10,
"HQExtName": "mp3",
"AlbumPrivilege": 10,
"isPrepublish": 0,
"Scid": 78323781,
"SuperFileHash": "",
"QualityLevel": 3,
"OriSongName": "天下",
"TopicUrl": "",
"HQFileHash": "26D2CE7019A7ABFA0AC539739404F1BF",
"EMixSongID": "4fql9xab",
"SQExtName": "flac",
"recommend_type": 0,
"SQBitrate": 1043,
"MvHash": "AC2FB481F41DBDCA5CF4890B26246226",
"SuperFileSize": 0,
"MvType": 2,
"MixSongID": "268299573",
"SuperBitrate": 0,
"HasAlbum": 1,
"MatchFlag": 1,
"FailProcess": 4,
"ResBitrate": 1808,
"PrepublishInfo": {
"ReserveCount": 0,
"DisplayTime": "",
"PublishTime": "",
"Id": 0
},
"mvTotal": 0,
"OwnerCount": 2975323,
"trans_param": {
"ogg_128_hash": "60FD0274990AC67939936B3B71D7554D",
"classmap": {
"attr0": 234885128
},
"language": "国语",
"cpy_attr0": 15488,
"musicpack_advance": 1,
"display": 32,
"display_rate": 1,
"ogg_320_filesize": 8659463,
"qualitymap": {
"attr0": 1061142645
},
"ogg_320_hash": "CAD61E7BE62C30D2D8E6158EDFA87DAC",
"ogg_128_filesize": 2521697,
"cid": 108423664,
"cpy_grade": 5,
"appid_block": "3124",
"ipmap": {
"attr0": 100667392
},
"hash_offset": {
"clip_hash": "4922C62E5C78D30DBDFA3CF5F80BFA7B",
"start_byte": 0,
"end_ms": 60000,
"end_byte": 960119,
"file_type": 0,
"start_ms": 0,
"offset_hash": "713149645D6F3A84E911B9E38FE66575"
},
"hash_multitrack": "ECD60C01A4B28819373B477731F2BF59",
"pay_block_tpl": 1,
"cpy_level": 1
},
"HeatLevel": 6,
"Bitrate": 128,
"Duration": 221,
"AlbumAux": "",
"A320Privilege": 10,
"RankId": 8888,
"ResFileSize": 50071946,
"SQPrivilege": 10,
"vvid": "",
"AlbumID": "38606351",
"HQFileSize": 8863020
}
]
},
"status": 1
}