From d880a7834e25da739a88791429ab545f30653dc6 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 5 Mar 2023 16:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/utils/musicSdk/kg/comment.js | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/renderer/utils/musicSdk/kg/comment.js b/src/renderer/utils/musicSdk/kg/comment.js index 97a80528..6d2e0ea7 100644 --- a/src/renderer/utils/musicSdk/kg/comment.js +++ b/src/renderer/utils/musicSdk/kg/comment.js @@ -2,17 +2,22 @@ import { httpFetch } from '../../request' import { decodeName, dateFormat2 } from '../../index' import { toMD5 } from '../utils' +const signatureParams = (params) => { + let OIlwieks = '28dk2k092lksi2UIkp' + let sign_params = `OIlwieks${OIlwieks}${params.replace(/&/g, '')}OIlwieks${OIlwieks}` + return toMD5(sign_params) +} + export default { _requestObj: null, _requestObj2: null, - async getComment({ hash, songmid }, page = 1, limit = 20) { + async getComment({ hash }, page = 1, limit = 20) { if (this._requestObj) this._requestObj.cancelHttp() let timestamp = Date.now() - let OIlwieks = '28dk2k092lksi2UIkp' - let sign_params = `OIlwieks${OIlwieks}appid=1005childrenid=${songmid}clienttime=${timestamp}clienttoken=0364933ef7daa8c0f150e91b49e6bc38ceaf106e6c49400c230936282b0a0dd8clientver=11409code=fc4be23b4e972707f36b8a828a93ba8adfid=347VvU1FGsNW0XwQu30ZZolsextdata=${hash}kugouid=0mid=162495122043363656740233957790194166813mixsongid=0p=${page}pagesize=${limit}uuid=0ver=10OIlwieks${OIlwieks}` - let signature = toMD5(sign_params) - const _requestObj = httpFetch(`http://m.comment.service.kugou.com/v1/cmtlist?dfid=347VvU1FGsNW0XwQu30ZZols&mid=162495122043363656740233957790194166813&signature=${signature}&clienttime=${timestamp}&uuid=0&extdata=${hash}&appid=1005&code=fc4be23b4e972707f36b8a828a93ba8a&childrenid=${songmid}&clientver=11409&p=${page}&mixsongid=0&clienttoken=0364933ef7daa8c0f150e91b49e6bc38ceaf106e6c49400c230936282b0a0dd8&pagesize=${limit}&ver=10&kugouid=0`, { + const params = `appid=1005&clienttime=${timestamp}&clienttoken=0&clientver=11409&code=fc4be23b4e972707f36b8a828a93ba8a&dfid=0&extdata=${hash}&kugouid=0&mid=16249512204336365674023395779019&mixsongid=0&p=${page}&pagesize=${limit}&uuid=0&ver=10` + let signature = signatureParams(params) + const _requestObj = httpFetch(`http://m.comment.service.kugou.com/v1/cmtlist?${params}&signature=${signature}`, { headers: { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.24', }, @@ -22,14 +27,13 @@ export default { if (statusCode != 200 || body.err_code !== 0) throw new Error('获取评论失败') return { source: 'kg', comments: this.filterComment(body.list || []), total: body.count, page, limit, maxPage: body.maxPage } }, - async getHotComment({ hash, songmid }, page = 1, limit = 20) { + async getHotComment({ hash }, page = 1, limit = 20) { // console.log(songmid) if (this._requestObj2) this._requestObj2.cancelHttp() let timestamp = Date.now() - let OIlwieks = '28dk2k092lksi2UIkp' - let sign_params = `OIlwieks${OIlwieks}appid=1005childrenid=${songmid}clienttime=${timestamp}clienttoken=0364933ef7daa8c0f150e91b49e6bc38ceaf106e6c49400c230936282b0a0dd8clientver=11409code=fc4be23b4e972707f36b8a828a93ba8adfid=347VvU1FGsNW0XwQu30ZZolsextdata=${hash}kugouid=0mid=162495122043363656740233957790194166813mixsongid=0p=${page}pagesize=${limit}uuid=0ver=10OIlwieks${OIlwieks}` - let signature = toMD5(sign_params) - const _requestObj2 = httpFetch(`http://m.comment.service.kugou.com/v1/weightlist?dfid=347VvU1FGsNW0XwQu30ZZols&mid=162495122043363656740233957790194166813&signature=${signature}&clienttime=${timestamp}&uuid=0&extdata=${hash}&appid=1005&code=fc4be23b4e972707f36b8a828a93ba8a&childrenid=${songmid}&clientver=11409&p=${page}&mixsongid=0&clienttoken=0364933ef7daa8c0f150e91b49e6bc38ceaf106e6c49400c230936282b0a0dd8&pagesize=${limit}&ver=10&kugouid=0`, { + const params = `appid=1005&clienttime=${timestamp}&clienttoken=0&clientver=11409&code=fc4be23b4e972707f36b8a828a93ba8a&dfid=0&extdata=${hash}&kugouid=0&mid=16249512204336365674023395779019&mixsongid=0&p=${page}&pagesize=${limit}&uuid=0&ver=10` + let signature = signatureParams(params) + const _requestObj2 = httpFetch(`http://m.comment.service.kugou.com/v1/weightlist?${params}&signature=${signature}`, { headers: { 'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi', },