修复kw搜索ID存储变更(MUSIC_ -> MUSIRC_)导致的通过搜索获取到的歌曲功能不正常的问题

This commit is contained in:
彭狸花喵 2023-09-23 09:26:09 +00:00
parent bf790a908b
commit 8756ad5644
6 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ import { dnsLookup } from '../utils'
const api_temp = {
getMusicUrl(songInfo, type) {
const requestObj = httpFetch(`http://tm.tempmusics.tk/url/kw/${songInfo.songmid}/${type}`, {
const requestObj = httpFetch(`http://tm.tempmusics.tk/url/kw/${songInfo.songmid.match(/\d+/g)[0]}/${type}`, {
method: 'get',
headers,
timeout,

View File

@ -16,7 +16,7 @@ const api_test = {
// return requestObj
// },
getMusicUrl(songInfo, type) {
const requestObj = httpFetch(`http://ts.tempmusics.tk/url/kw/${songInfo.songmid}/${type}`, {
const requestObj = httpFetch(`http://ts.tempmusics.tk/url/kw/${songInfo.songmid}.match(/\d+/g)[0]/${type}`, {
method: 'get',
timeout,
headers,

View File

@ -7,7 +7,7 @@ export default {
async getComment({ songmid }, page = 1, limit = 20) {
if (this._requestObj) this._requestObj.cancelHttp()
const _requestObj = httpFetch(`http://ncomment.kuwo.cn/com.s?f=web&type=get_comment&aapiver=1&prod=kwplayer_ar_10.5.2.0&digest=15&sid=${songmid}&start=${limit * (page - 1)}&msgflag=1&count=${limit}&newver=3&uid=0`, {
const _requestObj = httpFetch(`http://ncomment.kuwo.cn/com.s?f=web&type=get_comment&aapiver=1&prod=kwplayer_ar_10.5.2.0&digest=15&sid=${songmid.match(/\d+/g)[0]}&start=${limit * (page - 1)}&msgflag=1&count=${limit}&newver=3&uid=0`, {
headers: {
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9;)',
},
@ -29,7 +29,7 @@ export default {
async getHotComment({ songmid }, page = 1, limit = 100) {
if (this._requestObj2) this._requestObj2.cancelHttp()
const _requestObj2 = httpFetch(`http://ncomment.kuwo.cn/com.s?f=web&type=get_rec_comment&aapiver=1&prod=kwplayer_ar_10.5.2.0&digest=15&sid=${songmid}&start=${limit * (page - 1)}&msgflag=1&count=${limit}&newver=3&uid=0`, {
const _requestObj2 = httpFetch(`http://ncomment.kuwo.cn/com.s?f=web&type=get_rec_comment&aapiver=1&prod=kwplayer_ar_10.5.2.0&digest=15&sid=${songmid.match(/\d+/g)[0]}&start=${limit * (page - 1)}&msgflag=1&count=${limit}&newver=3&uid=0`, {
headers: {
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9;)',
},

View File

@ -65,7 +65,7 @@ const kw = {
getMusicInfo(songInfo) {
if (this._musicInfoRequestObj) this._musicInfoRequestObj.cancelHttp()
this._musicInfoRequestObj = httpFetch(`http://www.kuwo.cn/api/www/music/musicInfo?mid=${songInfo.songmid}`)
this._musicInfoRequestObj = httpFetch(`http://www.kuwo.cn/api/www/music/musicInfo?mid=${songInfo.songmid.match(/\d+/g)[0]}`)
return this._musicInfoRequestObj.promise.then(({ body }) => {
return body.code === 200 ? body.data : Promise.reject(new Error(body.msg))
})
@ -91,7 +91,7 @@ const kw = {
},
getMusicDetailPageUrl(songInfo) {
return `http://www.kuwo.cn/play_detail/${songInfo.songmid}`
return `http://www.kuwo.cn/play_detail/${songInfo.songmid.match(/\d+/g)[0]}`
},
// init() {

View File

@ -232,7 +232,7 @@ export default {
// },
getLyric(musicInfo, isGetLyricx = true) {
// this.getLyric2(musicInfo)
const requestObj = httpFetch(`http://newlyric.kuwo.cn/newlyric.lrc?${buildParams(musicInfo.songmid, isGetLyricx)}`)
const requestObj = httpFetch(`http://newlyric.kuwo.cn/newlyric.lrc?${buildParams(musicInfo.songmid.match(/\d+/g)[0], isGetLyricx)}`)
requestObj.promise = requestObj.promise.then(({ statusCode, body, raw }) => {
if (statusCode != 200) return Promise.reject(new Error(JSON.stringify(body)))
return decodeLyric({ lrcBase64: raw.toString('base64'), isGetLyricx }).then(base64Data => {

View File

@ -2,7 +2,7 @@ import { httpFetch } from '../../request'
export default {
getPic({ songmid }) {
const requestObj = httpFetch(`http://artistpicserver.kuwo.cn/pic.web?corp=kuwo&type=rid_pic&pictype=500&size=500&rid=${songmid}`)
const requestObj = httpFetch(`http://artistpicserver.kuwo.cn/pic.web?corp=kuwo&type=rid_pic&pictype=500&size=500&rid=${songmid.match(/\d+/g)[0]}`)
requestObj.promise = requestObj.promise.then(({ body }) => /^http/.test(body) ? body : null)
return requestObj.promise
},