百度音乐接口的使用

百度公开有一个音乐接口,里面分好了频道类别。下面是3个接口的一个url地址。

const QString url_getOnlineChannel = "http://fm.baidu.com/dev/api/?tn=channellist";             //url->频道ID
const QString url_getOnlineSheet = "http://fm.baidu.com/dev/api/?tn=playlist&format=json&id=";  //频道ID->歌曲ID
const QString url_getOnlineMusic = "http://music.baidu.com/data/music/fmlink?type=mp3&rate=320&songIds=";  //歌曲ID->歌曲信息

访问每个url都会返回一个JSON的信息,通过解析JSON来获取其中的信息。
流程就如url地址一样,分为3步:

  1. 获取频道列表。
    无条件访问 http://fm.baidu.com/dev/api/?tn=channellist
    这里可以获取到所有的频道信息,如下:
    {"hash_code":"ef54151ee31553c05329ac7e66aaedc4","channel_list": [{"channel_id":"public_tuijian_spring","channel_name":"\u6f2b\u6b65\u6625\u5929","channel_order":0,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":11},{"channel_id":"public_tuijian_autumn","channel_name":"\u79cb\u65e5\u79c1\u8bed","channel_order":0,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":12},{"channel_id":"public_tuijian_winter","channel_name":"\u6e29\u6696\u51ac\u65e5","channel_order":10101,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":10},{"channel_id":"public_tuijian_rege","channel_name":"\u70ed\u6b4c","channel_order":10105,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":4,"source_id":0,"pv_order":1},{"channel_id":"public_tuijian_ktv","channel_name":"KTV\u91d1\u66f2","channel_order":10106,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":2},{"channel_id":"public_tuijian_billboard","channel_name":"Billboard","channel_order":10107,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_tuijian_chengmingqu","channel_name":"\u6210\u540d\u66f2","channel_order":10108,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":3},{"channel_id":"public_tuijian_wangluo","channel_name":"\u7f51\u7edc\u6b4c\u66f2","channel_order":10109,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":2,"source_id":0,"pv_order":4},{"channel_id":"public_tuijian_kaiche","channel_name":"\u5f00\u8f66","channel_order":10110,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":7},{"channel_id":"public_tuijian_yingshi","channel_name":"\u5f71\u89c6","channel_order":10113,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":8},{"channel_id":"public_tuijian_suibiantingting","channel_name":"\u968f\u4fbf\u542c\u542c","channel_order":10114,"cate_id":"tuijian","cate":"\u63a8\u8350\u9891\u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":5},{"channel_id":"public_shiguang_jingdianlaoge","channel_name":"\u7ecf\u5178\u8001\u6b4c","channel_order":10201,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":1},{"channel_id":"public_shiguang_70hou","channel_name":"70\u540e","channel_order":10202,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_shiguang_80hou","channel_name":"80\u540e","channel_order":10203,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":2},{"channel_id":"public_shiguang_90hou","channel_name":"90\u540e","channel_order":10204,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_shiguang_xinge","channel_name":"\u706b\u7206\u65b0\u6b4c","channel_order":10205,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":3,"source_id":33,"pv_order":4},{"channel_id":"public_shiguang_erge","channel_name":"\u513f\u6b4c","channel_order":10206,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":1,"source_id":0,"pv_order":7},{"channel_id":"public_shiguang_lvxing","channel_name":"\u65c5\u884c","channel_order":10208,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":8},{"channel_id":"public_shiguang_yedian","channel_name":"\u591c\u5e97","channel_order":10209,"cate_id":"shiguang","cate":"\u65f6\u5149\u9891\u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":5},{"channel_id":"public_fengge_liuxing","channel_name":"\u6d41\u884c","channel_order":10301,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_fengge_yaogun","channel_name":"\u6447\u6eda","channel_order":10302,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":5},{"channel_id":"public_fengge_minyao","channel_name":"\u6c11\u8c23","channel_order":10303,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":3,"source_id":50,"pv_order":8},{"channel_id":"public_fengge_qingyinyue","channel_name":"\u8f7b\u97f3\u4e50","channel_order":10304,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_fengge_xiaoqingxin","channel_name":"\u5c0f\u6e05\u65b0","channel_order":10305,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":4},{"channel_id":"public_fengge_zhongguofeng","channel_name":"\u4e2d\u56fd\u98ce","channel_order":10306,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":7},{"channel_id":"public_fengge_dj","channel_name":"DJ\u821e\u66f2","channel_order":10308,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":2},{"channel_id":"public_fengge_dianyingyuansheng","channel_name":"\u7535\u5f71","channel_order":10309,"cate_id":"fengge","cate":"\u98ce\u683c\u9891\u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":6},{"channel_id":"public_xinqing_qingsongjiari","channel_name":"\u8f7b\u677e\u5047\u65e5","channel_order":10401,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":4},{"channel_id":"public_xinqing_huankuai","channel_name":"\u6b22\u5feb\u65cb\u5f8b","channel_order":10402,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_xinqing_tianmi","channel_name":"\u751c\u871c\u611f\u53d7","channel_order":10403,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_xinqing_jimo","channel_name":"\u5bc2\u5bde","channel_order":10404,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":2,"source_id":0,"pv_order":7},{"channel_id":"public_xinqing_qingge","channel_name":"\u5355\u8eab\u60c5\u6b4c","channel_order":10405,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":8},{"channel_id":"public_xinqing_shuhuan","channel_name":"\u8212\u7f13\u8282\u594f","channel_order":10406,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":2},{"channel_id":"public_xinqing_yonglanwuhou","channel_name":"\u6175\u61d2\u5348\u540e","channel_order":10407,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":3,"source_id":15,"pv_order":5},{"channel_id":"public_xinqing_shanggan","channel_name":"\u4f24\u611f","channel_order":10408,"cate_id":"xinqing","cate":"\u5fc3\u60c5\u9891\u9053","cate_order":4,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_yuzhong_huayu","channel_name":"\u534e\u8bed","channel_order":10501,"cate_id":"yuzhong","cate":"\u8bed\u79cd\u9891\u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_yuzhong_oumei","channel_name":"\u6b27\u7f8e","channel_order":10502,"cate_id":"yuzhong","cate":"\u8bed\u79cd\u9891\u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":2},{"channel_id":"public_yuzhong_riyu","channel_name":"\u65e5\u8bed","channel_order":10503,"cate_id":"yuzhong","cate":"\u8bed\u79cd\u9891\u9053","cate_order":5,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_yuzhong_hanyu","channel_name":"\u97e9\u8bed","channel_order":10504,"cate_id":"yuzhong","cate":"\u8bed\u79cd\u9891\u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":4},{"channel_id":"public_yuzhong_yueyu","channel_name":"\u7ca4\u8bed","channel_order":10505,"cate_id":"yuzhong","cate":"\u8bed\u79cd\u9891\u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":5}],"status":0}
  • 获取歌曲列表。
    通过上述获取到的 channel_id 信息加在 http://fm.baidu.com/dev/api/?tn=playlist&format=json&id= 后,便可以得到该频道的音乐信息。
    如访问:http://fm.baidu.com/dev/api/?tn=playlist&format=json&id=public_yuzhong_yueyu ,获取如下JSON
    {"hash_code":"ef54151ee31553c05329ac7e66aaedc4","channel_id":"public_yuzhong_yueyu","channel_name":"\u7ca4\u8bed","list": [{"id":1039198,"type":-1,"method":0,"flow_mark":0},{"id":422954,"type":-1,"method":0,"flow_mark":0},{"id":7343735,"type":-1,"method":0,"flow_mark":0},{"id":2124665,"type":-1,"method":0,"flow_mark":0},{"id":219930,"type":-1,"method":0,"flow_mark":0},{"id":1424805,"type":-1,"method":0,"flow_mark":0},{"id":307171,"type":-1,"method":0,"flow_mark":0},{"id":10270415,"type":-1,"method":0,"flow_mark":0},{"id":273708,"type":-1,"method":0,"flow_mark":0},{"id":7324399,"type":-1,"method":0,"flow_mark":0},{"id":7319721,"type":-1,"method":0,"flow_mark":0},{"id":65545703,"type":-1,"method":0,"flow_mark":0},{"id":759408,"type":-1,"method":0,"flow_mark":0},{"id":1420738,"type":-1,"method":0,"flow_mark":0},{"id":338145,"type":-1,"method":0,"flow_mark":0},{"id":23165179,"type":-1,"method":0,"flow_mark":0},{"id":292002,"type":-1,"method":0,"flow_mark":0},{"id":7325160,"type":-1,"method":0,"flow_mark":0},{"id":206460,"type":-1,"method":0,"flow_mark":0},{"id":302740,"type":-1,"method":0,"flow_mark":0},{"id":350571,"type":-1,"method":0,"flow_mark":0},{"id":7382995,"type":-1,"method":0,"flow_mark":0},{"id":13757337,"type":-1,"method":0,"flow_mark":0},{"id":7325428,"type":-1,"method":0,"flow_mark":0},{"id":7317693,"type":-1,"method":0,"flow_mark":0},{"id":14962362,"type":-1,"method":0,"flow_mark":0},{"id":2047054,"type":-1,"method":0,"flow_mark":0},{"id":229011,"type":-1,"method":0,"flow_mark":0},{"id":483664,"type":-1,"method":0,"flow_mark":0},{"id":7344015,"type":-1,"method":0,"flow_mark":0},{"id":14962298,"type":-1,"method":0,"flow_mark":0},{"id":806049,"type":-1,"method":0,"flow_mark":0},{"id":7314224,"type":-1,"method":0,"flow_mark":0},{"id":319168,"type":-1,"method":0,"flow_mark":0},{"id":7319722,"type":-1,"method":0,"flow_mark":0},{"id":8276656,"type":-1,"method":0,"flow_mark":0},{"id":23165164,"type":-1,"method":0,"flow_mark":0},{"id":14441641,"type":-1,"method":0,"flow_mark":0},{"id":7352950,"type":-1,"method":0,"flow_mark":0},{"id":7315407,"type":-1,"method":0,"flow_mark":0},{"id":1000860,"type":-1,"method":0,"flow_mark":0},{"id":268353,"type":-1,"method":0,"flow_mark":0},{"id":2124659,"type":-1,"method":0,"flow_mark":0},{"id":7343428,"type":-1,"method":0,"flow_mark":0},{"id":5572508,"type":-1,"method":0,"flow_mark":0},{"id":2047062,"type":-1,"method":0,"flow_mark":0},{"id":7324907,"type":-1,"method":0,"flow_mark":0},{"id":220609,"type":-1,"method":0,"flow_mark":0},{"id":14879207,"type":-1,"method":0,"flow_mark":0},{"id":7320720,"type":-1,"method":0,"flow_mark":0},{"id":65545705,"type":-1,"method":0,"flow_mark":0},{"id":7315402,"type":-1,"method":0,"flow_mark":0},{"id":2110947,"type":-1,"method":0,"flow_mark":0},{"id":350388,"type":-1,"method":0,"flow_mark":0},{"id":2937956,"type":-1,"method":0,"flow_mark":0},{"id":7282667,"type":-1,"method":0,"flow_mark":0},{"id":7316029,"type":-1,"method":0,"flow_mark":0},{"id":341640,"type":-1,"method":0,"flow_mark":0},{"id":448036,"type":-1,"method":0,"flow_mark":0},{"id":7326296,"type":-1,"method":0,"flow_mark":0},{"id":350506,"type":-1,"method":0,"flow_mark":0},{"id":16602812,"type":-1,"method":0,"flow_mark":0},{"id":23165287,"type":-1,"method":0,"flow_mark":0},{"id":5548132,"type":-1,"method":0,"flow_mark":0},{"id":339826,"type":-1,"method":0,"flow_mark":0},{"id":7314946,"type":-1,"method":0,"flow_mark":0},{"id":960735,"type":-1,"method":0,"flow_mark":0},{"id":23165261,"type":-1,"method":0,"flow_mark":0},{"id":7316045,"type":-1,"method":0,"flow_mark":0},{"id":7344366,"type":-1,"method":0,"flow_mark":0},{"id":7324948,"type":-1,"method":0,"flow_mark":0},{"id":7321545,"type":-1,"method":0,"flow_mark":0},{"id":12340411,"type":-1,"method":0,"flow_mark":0},{"id":7319724,"type":-1,"method":0,"flow_mark":0},{"id":14949057,"type":-1,"method":0,"flow_mark":0},{"id":7312965,"type":-1,"method":0,"flow_mark":0},{"id":479911,"type":-1,"method":0,"flow_mark":0},{"id":7343489,"type":-1,"method":0,"flow_mark":0},{"id":2088695,"type":-1,"method":0,"flow_mark":0},{"id":2124656,"type":-1,"method":0,"flow_mark":0},{"id":7315406,"type":-1,"method":0,"flow_mark":0},{"id":400175,"type":-1,"method":0,"flow_mark":0},{"id":1080706,"type":-1,"method":0,"flow_mark":0},{"id":399393,"type":-1,"method":0,"flow_mark":0},{"id":300216,"type":-1,"method":0,"flow_mark":0},{"id":7312969,"type":-1,"method":0,"flow_mark":0},{"id":7382982,"type":-1,"method":0,"flow_mark":0},{"id":7320709,"type":-1,"method":0,"flow_mark":0},{"id":7313025,"type":-1,"method":0,"flow_mark":0},{"id":287183,"type":-1,"method":0,"flow_mark":0},{"id":7312860,"type":-1,"method":0,"flow_mark":0},{"id":29013970,"type":-1,"method":0,"flow_mark":0},{"id":7327371,"type":-1,"method":0,"flow_mark":0},{"id":913503,"type":-1,"method":0,"flow_mark":0},{"id":2129477,"type":-1,"method":0,"flow_mark":0},{"id":7325117,"type":-1,"method":0,"flow_mark":0},{"id":7319732,"type":-1,"method":0,"flow_mark":0},{"id":7320719,"type":-1,"method":0,"flow_mark":0},{"id":7316023,"type":-1,"method":0,"flow_mark":0},{"id":7325532,"type":-1,"method":0,"flow_mark":0},{"id":7314949,"type":-1,"method":0,"flow_mark":0},{"id":18281267,"type":-1,"method":0,"flow_mark":0},{"id":7320716,"type":-1,"method":0,"flow_mark":0},{"id":7312383,"type":-1,"method":0,"flow_mark":0},{"id":338033,"type":-1,"method":0,"flow_mark":0},{"id":7349969,"type":-1,"method":0,"flow_mark":0},{"id":7282701,"type":-1,"method":0,"flow_mark":0},{"id":998406,"type":-1,"method":0,"flow_mark":0},{"id":14962356,"type":-1,"method":0,"flow_mark":0},{"id":18298495,"type":-1,"method":0,"flow_mark":0},{"id":7324737,"type":-1,"method":0,"flow_mark":0},{"id":971277,"type":-1,"method":0,"flow_mark":0},{"id":2062242,"type":-1,"method":0,"flow_mark":0},{"id":2047058,"type":-1,"method":0,"flow_mark":0},{"id":350443,"type":-1,"method":0,"flow_mark":0},{"id":7354605,"type":-1,"method":0,"flow_mark":0},{"id":399170,"type":-1,"method":0,"flow_mark":0},{"id":603848,"type":-1,"method":0,"flow_mark":0},{"id":18282163,"type":-1,"method":0,"flow_mark":0},{"id":7324842,"type":-1,"method":0,"flow_mark":0},{"id":18316259,"type":-1,"method":0,"flow_mark":0},{"id":29014216,"type":-1,"method":0,"flow_mark":0},{"id":7323383,"type":-1,"method":0,"flow_mark":0},{"id":7313254,"type":-1,"method":0,"flow_mark":0},{"id":7321541,"type":-1,"method":0,"flow_mark":0},{"id":1073743,"type":-1,"method":0,"flow_mark":0},{"id":7312970,"type":-1,"method":0,"flow_mark":0},{"id":1267427,"type":-1,"method":0,"flow_mark":0},{"id":2047053,"type":-1,"method":0,"flow_mark":0},{"id":252734,"type":-1,"method":0,"flow_mark":0},{"id":934232,"type":-1,"method":0,"flow_mark":0},{"id":7319113,"type":-1,"method":0,"flow_mark":0},{"id":7341932,"type":-1,"method":0,"flow_mark":0},{"id":339644,"type":-1,"method":0,"flow_mark":0},{"id":2063044,"type":-1,"method":0,"flow_mark":0},{"id":1519330,"type":-1,"method":0,"flow_mark":0},{"id":7282665,"type":-1,"method":0,"flow_mark":0},{"id":7341000,"type":-1,"method":0,"flow_mark":0},{"id":7319916,"type":-1,"method":0,"flow_mark":0},{"id":14902466,"type":-1,"method":0,"flow_mark":0},{"id":27936596,"type":-1,"method":0,"flow_mark":0},{"id":795929,"type":-1,"method":0,"flow_mark":0},{"id":400220,"type":-1,"method":0,"flow_mark":0},{"id":7319912,"type":-1,"method":0,"flow_mark":0},{"id":881122,"type":-1,"method":0,"flow_mark":0},{"id":7312968,"type":-1,"method":0,"flow_mark":0},{"id":1248915,"type":-1,"method":0,"flow_mark":0},{"id":14962304,"type":-1,"method":0,"flow_mark":0},{"id":339719,"type":-1,"method":0,"flow_mark":0},{"id":5572481,"type":-1,"method":0,"flow_mark":0},{"id":265449,"type":-1,"method":0,"flow_mark":0},{"id":7316035,"type":-1,"method":0,"flow_mark":0},{"id":7312394,"type":-1,"method":0,"flow_mark":0},{"id":339970,"type":-1,"method":0,"flow_mark":0},{"id":688270,"type":-1,"method":0,"flow_mark":0},{"id":7325643,"type":-1,"method":0,"flow_mark":0},{"id":7327369,"type":-1,"method":0,"flow_mark":0},{"id":2124662,"type":-1,"method":0,"flow_mark":0},{"id":2047056,"type":-1,"method":0,"flow_mark":0},{"id":231265,"type":-1,"method":0,"flow_mark":0},{"id":7328680,"type":-1,"method":0,"flow_mark":0},{"id":7326389,"type":-1,"method":0,"flow_mark":0},{"id":23165149,"type":-1,"method":0,"flow_mark":0},{"id":2046417,"type":-1,"method":0,"flow_mark":0},{"id":1689146,"type":-1,"method":0,"flow_mark":0},{"id":7341801,"type":-1,"method":0,"flow_mark":0},{"id":7321283,"type":-1,"method":0,"flow_mark":0},{"id":595425,"type":-1,"method":0,"flow_mark":0},{"id":7311044,"type":-1,"method":0,"flow_mark":0},{"id":7324881,"type":-1,"method":0,"flow_mark":0},{"id":853841,"type":-1,"method":0,"flow_mark":0},{"id":400127,"type":-1,"method":0,"flow_mark":0},{"id":7382984,"type":-1,"method":0,"flow_mark":0},{"id":7325695,"type":-1,"method":0,"flow_mark":0},{"id":7315410,"type":-1,"method":0,"flow_mark":0},{"id":224032,"type":-1,"method":0,"flow_mark":0},{"id":212689,"type":-1,"method":0,"flow_mark":0},{"id":811032,"type":-1,"method":0,"flow_mark":0},{"id":7323445,"type":-1,"method":0,"flow_mark":0},{"id":2124658,"type":-1,"method":0,"flow_mark":0},{"id":7333064,"type":-1,"method":0,"flow_mark":0},{"id":7327365,"type":-1,"method":0,"flow_mark":0},{"id":763045,"type":-1,"method":0,"flow_mark":0},{"id":292122,"type":-1,"method":0,"flow_mark":0},{"id":7382993,"type":-1,"method":0,"flow_mark":0},{"id":734742,"type":-1,"method":0,"flow_mark":0},{"id":7319730,"type":-1,"method":0,"flow_mark":0},{"id":807360,"type":-1,"method":0,"flow_mark":0},{"id":18300154,"type":-1,"method":0,"flow_mark":0},{"id":1029781,"type":-1,"method":0,"flow_mark":0},{"id":65545697,"type":-1,"method":0,"flow_mark":0},{"id":7382991,"type":-1,"method":0,"flow_mark":0},{"id":7321543,"type":-1,"method":0,"flow_mark":0},{"id":7319588,"type":-1,"method":0,"flow_mark":0},{"id":7314104,"type":-1,"method":0,"flow_mark":0},{"id":11386710,"type":-1,"method":0,"flow_mark":0},{"id":7324540,"type":-1,"method":0,"flow_mark":0},{"id":273235,"type":-1,"method":0,"flow_mark":0},{"id":7346027,"type":-1,"method":0,"flow_mark":0},{"id":1088374,"type":-1,"method":0,"flow_mark":0}],"results":null,"status":0}
  • 获取具体的歌曲信息。
    同样,根据上述JSON获得 id 信息加上 http://music.baidu.com/data/music/fmlink?type=mp3&rate=320&songIds= 便可以获得某一首歌的具体信息。
    如访问:http://music.baidu.com/data/music/fmlink?type=mp3&rate=320&songIds=913503 ,获得如下的json:
    {"errorCode":22000,"data":{"xcode":"4496e58ee1d77dfb10372a4da22c77ae","songList":[{"queryId":"913503","songId":913503,"songName":"\u5915\u9633\u65e0\u9650\u597d","artistId":"1077","artistName":"\u9648\u5955\u8fc5","albumId":689097,"albumName":"U-87","songPicSmall":"http://musicdata.baidu.com/data2/pic/88653138/88653138.jpg@s_0,w_90","songPicBig":"http://musicdata.baidu.com/data2/pic/88653138/88653138.jpg@s_0,w_150","songPicRadio":"http://musicdata.baidu.com/data2/pic/88653138/88653138.jpg@s_0,w_300","lrcLink":"http://musicdata.baidu.com/data2/lrc/13982404/13982404.lrc","version":"","copyType":0,"time":244,"linkCode":22000,"songLink":"http://yinyueshiting.baidu.com/data2/music/136477439/913503140400320.mp3?xcode=4496e58ee1d77dfbd1fcd5f6c50b1ab0","showLink":"http://yinyueshiting.baidu.com/data2/music/136477439/913503140400320.mp3?xcode=4496e58ee1d77dfbd1fcd5f6c50b1ab0","format":"mp3","rate":320,"size":9773199,"relateStatus":"0","resourceType":"0","source":"web"}]}}
    其中:songLink便是歌曲真实的在线可播放地址,还有其他许多的信息可以直接通过JSON上的Name信息看懂,就不一一赘述了。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,185评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,445评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,684评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,564评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,681评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,874评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,025评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,761评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,217评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,545评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,694评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,351评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,988评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,778评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,007评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,427评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,580评论 2 349

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,633评论 18 139
  • 对呀 我只是在寻找我的大树的路途上 被一片小草开的花给吸引了 现在花落了 我也该继续往前走了 我的大树还在前边等着...
    开始忘记阅读 238评论 0 0
  • 街角的理发店里 我年少的心事 碎了一地 而我用了多少借口 迎上你的影子 修好那侧像 只是 日子已断成三章 在此之前...
    T骑士阅读 144评论 0 3
  • free 内存使用 free -m total used free shared ...
    robertzhai阅读 574评论 0 4
  • 夜幕下,前一刻还寂然无声的梅赛德斯奔驰体育场骤然爆发出一阵嘈杂的欢呼声,“SKT!SKT!SKT!”的声响...
    ZoeFed阅读 687评论 0 3