询问各分类中最大自增ID

2019-08-05 03:46栏目:网站首页

假如现在有表结构:

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

CREATE TABLE `msg_detail` (
    `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
    `title` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '标题',
    `content` TEXT NOT NULL COMMENT '内容',
    `audio_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '音频地址',
    `type_id` TINYINT(4) NOT NULL DEFAULT '0',
     PRIMARY KEY (`id`),
    INDEX `cid` (`cid`) USING BTREE,
    INDEX `column_id` (`column_id`) USING BTREE
)
COMMENT='内参表'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1;
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步:

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

  1. 获取频道列表。
    无条件访问 http://fm.baidu.com/dev/api/?tn=channellist 。
    这里可以获取到所有的频道信息,如下:
    {"hash_code":"ef54151ee31553c05329ac7e66aaedc4","channel_list": [{"channel_id":"public_tuijian_spring","channel_name":"u6f2bu6b65u6625u5929","channel_order":0,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":11},{"channel_id":"public_tuijian_autumn","channel_name":"u79cbu65e5u79c1u8bed","channel_order":0,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":12},{"channel_id":"public_tuijian_winter","channel_name":"u6e29u6696u51acu65e5","channel_order":10101,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":10},{"channel_id":"public_tuijian_rege","channel_name":"u70edu6b4c","channel_order":10105,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":4,"source_id":0,"pv_order":1},{"channel_id":"public_tuijian_ktv","channel_name":"KTVu91d1u66f2","channel_order":10106,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","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":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_tuijian_chengmingqu","channel_name":"u6210u540du66f2","channel_order":10108,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":3},{"channel_id":"public_tuijian_wangluo","channel_name":"u7f51u7edcu6b4cu66f2","channel_order":10109,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":2,"source_id":0,"pv_order":4},{"channel_id":"public_tuijian_kaiche","channel_name":"u5f00u8f66","channel_order":10110,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":7},{"channel_id":"public_tuijian_yingshi","channel_name":"u5f71u89c6","channel_order":10113,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":8},{"channel_id":"public_tuijian_suibiantingting","channel_name":"u968fu4fbfu542cu542c","channel_order":10114,"cate_id":"tuijian","cate":"u63a8u8350u9891u9053","cate_order":1,"source_type":1,"source_id":0,"pv_order":5},{"channel_id":"public_shiguang_jingdianlaoge","channel_name":"u7ecfu5178u8001u6b4c","channel_order":10201,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":1},{"channel_id":"public_shiguang_70hou","channel_name":"70u540e","channel_order":10202,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_shiguang_80hou","channel_name":"80u540e","channel_order":10203,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":2},{"channel_id":"public_shiguang_90hou","channel_name":"90u540e","channel_order":10204,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_shiguang_xinge","channel_name":"u706bu7206u65b0u6b4c","channel_order":10205,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":3,"source_id":33,"pv_order":4},{"channel_id":"public_shiguang_erge","channel_name":"u513fu6b4c","channel_order":10206,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":1,"source_id":0,"pv_order":7},{"channel_id":"public_shiguang_lvxing","channel_name":"u65c5u884c","channel_order":10208,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":8},{"channel_id":"public_shiguang_yedian","channel_name":"u591cu5e97","channel_order":10209,"cate_id":"shiguang","cate":"u65f6u5149u9891u9053","cate_order":2,"source_type":2,"source_id":0,"pv_order":5},{"channel_id":"public_fengge_liuxing","channel_name":"u6d41u884c","channel_order":10301,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_fengge_yaogun","channel_name":"u6447u6eda","channel_order":10302,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":5},{"channel_id":"public_fengge_minyao","channel_name":"u6c11u8c23","channel_order":10303,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":3,"source_id":50,"pv_order":8},{"channel_id":"public_fengge_qingyinyue","channel_name":"u8f7bu97f3u4e50","channel_order":10304,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_fengge_xiaoqingxin","channel_name":"u5c0fu6e05u65b0","channel_order":10305,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":4},{"channel_id":"public_fengge_zhongguofeng","channel_name":"u4e2du56fdu98ce","channel_order":10306,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":7},{"channel_id":"public_fengge_dj","channel_name":"DJu821eu66f2","channel_order":10308,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":2},{"channel_id":"public_fengge_dianyingyuansheng","channel_name":"u7535u5f71","channel_order":10309,"cate_id":"fengge","cate":"u98ceu683cu9891u9053","cate_order":3,"source_type":2,"source_id":0,"pv_order":6},{"channel_id":"public_xinqing_qingsongjiari","channel_name":"u8f7bu677eu5047u65e5","channel_order":10401,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":4},{"channel_id":"public_xinqing_huankuai","channel_name":"u6b22u5febu65cbu5f8b","channel_order":10402,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_xinqing_tianmi","channel_name":"u751cu871cu611fu53d7","channel_order":10403,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":6},{"channel_id":"public_xinqing_jimo","channel_name":"u5bc2u5bde","channel_order":10404,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":2,"source_id":0,"pv_order":7},{"channel_id":"public_xinqing_qingge","channel_name":"u5355u8eabu60c5u6b4c","channel_order":10405,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":8},{"channel_id":"public_xinqing_shuhuan","channel_name":"u8212u7f13u8282u594f","channel_order":10406,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":1,"source_id":0,"pv_order":2},{"channel_id":"public_xinqing_yonglanwuhou","channel_name":"u6175u61d2u5348u540e","channel_order":10407,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":3,"source_id":15,"pv_order":5},{"channel_id":"public_xinqing_shanggan","channel_name":"u4f24u611f","channel_order":10408,"cate_id":"xinqing","cate":"u5fc3u60c5u9891u9053","cate_order":4,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_yuzhong_huayu","channel_name":"u534eu8bed","channel_order":10501,"cate_id":"yuzhong","cate":"u8bedu79cdu9891u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":1},{"channel_id":"public_yuzhong_oumei","channel_name":"u6b27u7f8e","channel_order":10502,"cate_id":"yuzhong","cate":"u8bedu79cdu9891u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":2},{"channel_id":"public_yuzhong_riyu","channel_name":"u65e5u8bed","channel_order":10503,"cate_id":"yuzhong","cate":"u8bedu79cdu9891u9053","cate_order":5,"source_type":2,"source_id":0,"pv_order":3},{"channel_id":"public_yuzhong_hanyu","channel_name":"u97e9u8bed","channel_order":10504,"cate_id":"yuzhong","cate":"u8bedu79cdu9891u9053","cate_order":5,"source_type":1,"source_id":0,"pv_order":4},{"channel_id":"public_yuzhong_yueyu","channel_name":"u7ca4u8bed","channel_order":10505,"cate_id":"yuzhong","cate":"u8bedu79cdu9891u9053","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; 

  • 获取歌曲列表。
    通过上述获取到的 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":"u7ca4u8bed","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":"u5915u9633u65e0u9650u597d","artistId":"1077","artistName":"u9648u5955u8fc5","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信息看懂,就不一一赘述了。

 

版权声明:本文由威尼斯人app发布于网站首页,转载请注明出处:询问各分类中最大自增ID