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}

 select
max(id),type_id from msg_detail group by type_id; 

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

  查询所有类型内参最大id,可用如下sql: 

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->歌曲信息
网站地图xml地图