2019.12QQ音乐播放接口最新配置(亲测可用)
config下的index.js 代理proxyTable配置:
'/api': {
target: 'https://c.y.qq.com', // 接口的域名
bypass: function (req, res, proxyOptions) {
req.headers.referer = 'https://c.y.qq.com/';
req.headers.host = 'c.y.qq.com';
},
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: {
'^/api': ''
}
},
'/vkey': {
target: 'https://u.y.qq.com', // 接口的域名
bypass: function (req, res, proxyOptions) {
req.headers.referer = 'https://u.y.qq.com/';
req.headers.host = 'u.y.qq.com';
},
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: {
'^/vkey': ''
}
}
singer.js里的的配置
export async function getMusic(songmid) {
const url = '/api/base/fcgi-bin/fcg_music_express_mobile3.fcg'
const data = Object.assign({}, commonParams, {
songmid: songmid,
filename: 'C400' + songmid + '.m4a',
guid: 6319873028, //会变,以实时抓取的数据为准
platform: 'yqq',
loginUin: 0,
hostUin: 0,
needNewCode: 0,
cid:205361747,
uin: 0,
format: 'json'
})
const res = await axios.get(url, {
params: data
})
return Promise.resolve(res.data)
}