rain120 / qq-music-api Goto Github PK
View Code? Open in Web Editor NEWQQ 音乐API koa2实现
Home Page: https://rain120.github.io/qq-music-api/
License: MIT License
QQ 音乐API koa2实现
Home Page: https://rain120.github.io/qq-music-api/
License: MIT License
getRanks?topId=26与getRanks?topId=4返回的数据相同,都是默认数据
getRanks?topId=26&limit=15&page=1返回为空
远程仓库的docker无法下载,提示要登录
可选参数
错误的项:
实际上:
比如:
page=0,limit=19 表示获取从0到19的歌单列表。
如果要获取下一页的,应传参为:page=20,limit=39
系统:
nodejs 版本(koa2要求版本是7.6.0+):
重现步骤尽量详细,不能含糊不清
如果不是提建议,提 issues 如果不照着模版来将不会优先处理或直接关闭
getSongLists接口中文乱码
http://localhost:3200/getCookie
Not Found
http://localhost:3200/getSearchByKey?key=%E5%91%A8%E6%9D%B0%E4%BC%A6
{"response":{"code":0,"data":{"keyword":"周杰伦","priority":0,"qc":[],"semantic":{"curnum":0,"curpage":0,"list":[],"totalnum":0},"song":{"curnum":0,"curpage":1,"list":[],"totalnum":0},"tab":0,"taglist":[],"totaltime":0,"zhida":null},"message":"","notice":"","subcode":0,"time":1642434810,"tips":""}}
/soso/fcgi-bin/client_search_cp {
opts: {
params: {
w: '周杰伦',
n: 10,
p: 1,
catZhida: 1,
remoteplace: 'txt.yqq.song',
format: 'json',
outCharset: 'utf-8',
ct: 24,
qqmusic_ver: 1298,
t: 0,
aggr: 1,
cr: 1,
lossless: 0,
flag_qc: 0,
platform: 'yqq.json'
},
g_tk: 1124214810,
loginUin: '0',
hostUin: 0,
inCharset: 'utf8',
outCharset: 'utf-8',
notice: 0,
platform: 'yqq.json',
needNewCode: 0,
headers: { referer: 'https://c.y.qq.com/', host: 'c.y.qq.com' }
}
}
/soso/fcgi-bin/client_search_cp request error
error Error: Request failed with status code 404
at createError (/root/qq-music-api/node_modules/axios/lib/core/createError.js:16:15)
at settle (/root/qq-music-api/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/root/qq-music-api/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
config: {
url: 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
referer: 'https://c.y.qq.com/',
host: 'c.y.qq.com',
'User-Agent': 'axios/0.21.4'
},
params: {
w: '周杰伦',
n: 10,
p: 1,
catZhida: 1,
remoteplace: 'txt.yqq.song',
format: 'json',
outCharset: 'utf-8',
ct: 24,
qqmusic_ver: 1298,
t: 0,
aggr: 1,
cr: 1,
lossless: 0,
flag_qc: 0,
platform: 'yqq.json'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 10000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json;text/plain;charset=utf-8;',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
g_tk: 1124214810,
loginUin: '0',
hostUin: 0,
inCharset: 'utf8',
outCharset: 'utf-8',
notice: 0,
platform: 'yqq.json',
needNewCode: 0,
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'c.y.qq.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'c.y.qq.com',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
timeout: 10000,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 61,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 10000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 3346,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 70,
[Symbol(triggerId)]: 65
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'GET /soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'referer: https://c.y.qq.com/\r\n' +
'host: c.y.qq.com\r\n' +
'User-Agent: axios/0.21.4\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype],
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
socket: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 404,
statusMessage: 'Not Found',
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular *1],
responseUrl: 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 12,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'c.y.qq.com',
protocol: 'https:',
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json',
_timeout: null,
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
referer: [Array],
host: [Array],
'user-agent': [Array]
},
[Symbol(kUniqueHeaders)]: null
},
response: {
status: 404,
statusText: 'Not Found',
headers: {
server: 'nginx',
date: 'Fri, 29 Jul 2022 11:37:47 GMT',
'content-type': 'text/html',
'content-length': '0',
connection: 'close',
'cache-control': 'no-cache'
},
config: {
url: 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp',
method: 'get',
headers: [Object],
params: [Object],
transformRequest: [Array],
transformResponse: [Array],
timeout: 10000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json;text/plain;charset=utf-8;',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: [Object],
g_tk: 1124214810,
loginUin: '0',
hostUin: 0,
inCharset: 'utf8',
outCharset: 'utf-8',
notice: 0,
platform: 'yqq.json',
needNewCode: 0,
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'GET /soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'referer: https://c.y.qq.com/\r\n' +
'host: c.y.qq.com\r\n' +
'User-Agent: axios/0.21.4\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/soso/fcgi-bin/client_search_cp?w=%E5%91%A8%E6%9D%B0%E4%BC%A6&n=10&p=1&catZhida=1&remoteplace=txt.yqq.song&format=json&outCharset=utf-8&ct=24&qqmusic_ver=1298&t=0&aggr=1&cr=1&lossless=0&flag_qc=0&platform=yqq.json',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'c.y.qq.com',
protocol: 'https:',
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(kUniqueHeaders)]: null
},
data: ''
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
AssertionError [ERR_ASSERTION]: status code must be a number
at Object.set status [as status] (/root/qq-music-api/node_modules/koa/lib/response.js:86:5)
at Object.assign (/root/qq-music-api/node_modules/delegates/index.js:92:31)
at Function.assign (<anonymous>)
at /root/qq-music-api/routers/context/getSearchByKey.js:22:10
at Generator.next (<anonymous>)
at asyncGeneratorStep (/root/qq-music-api/routers/context/getSearchByKey.js:1:103)
at _next (/root/qq-music-api/routers/context/getSearchByKey.js:3:194)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Is your feature request related to a problem? Please describe.
No, just a feature request.
Describe the solution you'd like
I want to make a deployment document to teach you how to deploy this project on GitHub pages.
你好,为什么我在浏览器测试接口,返回的数据不是中文,而是这种
"dissname": "\ufffd\ufffdѹ\ufffd\ufffdҩ \ufffd\ufffd \ufffd\ufffd\ufffdڰ\ufffdĦ\ufffd\ufffd\ufffd߷\ufffd\ufffd\ufffd"形式的
搜索歌曲后,请问怎么下载歌曲呢?response.data.song.list
中歌曲的 "url": "http://stream10.qqmusic.qq.com/xxx.wma
下不动
请问可以再docker下配置么?因为网易云那个我是在docker下运行的,机器本身cpu比较特殊。。。。斐讯N1,
你好 搜索结果 传入page参数 但是结果还是一样的 请问怎么解决呢?
Hi 各位使用和 forked
的小伙伴们, 我正在计划着将本项目的版本更新一下,由于本人时间有限,所以恳请各位的支援,欢迎大家 PR 或者在此处👇 讨论。
更多请看👇详情描述
v2.0.0
v2.0.0
大版本修改是为了修复之前 接口设计 的 可读性差 , API 不合理 等众多问题。
我们在旧版本的基础上, 针对性修改。所以对 接口参数, 接口返回, 路由 等方面做了一定的 优化, 我们推荐新用户使用当前时间最新版 v2.0.0
。
下面我们拿 singer.js
举个 🌰
const YRequest = require('../module/y-axios');
const URequest = require('../module/URequest');
const { commonParams } = require('../module/config');
const moment = require('moment');
const { handleXml } = require('../util/xml');
const singerParams = Object.assign(commonParams, {
g_tk: 1290642389,
sign: 'zzafsjavizx8rzd4m36c2a7e17c9f884980ef9092cb8809e415',
format: 'json',
});
// /singe/similar?singermid=0025NhlN2yWrP4
const similarOld = async (ctx, next) => {
const { singermid: singer_mid } = ctx.query;
const options = {
params: {
format: 'json',
outCharset: 'utf-8',
utf8: 1,
start: 0,
num: 5,
singer_mid,
},
};
return await YRequest({
url: '/v8/fcg-bin/fcg_v8_simsinger.fcg',
method: 'get',
options,
thenable: res => {
if (!singer_mid) {
ctx.status = 400;
ctx.body = {
message: 'no singermid',
};
return;
}
Object.assign(ctx, {
status: 200,
body: {
response: res.data,
},
});
},
catcher: error => {
console.log('error', error);
ctx.status = 400;
ctx.body = { error };
},
});
};
// 周杰伦 /singe/similar?id=4558&singermid=0025NhlN2yWrP4
const similar = async (ctx, next) => {
const { id: singerId, singermid: singerMid, pageSize: num = 5 } = ctx.query;
console.log('similar error: not support pageSize');
const data = {
comm: {
ct: 24,
cv: 10000,
},
similarSingerList: {
method: 'GetSimilarSingerList',
param: {
singerId: parseInt(singerId, 10),
singerMid,
// TODO: QQ 貌似不支持
num: 5,
},
module: 'music.SimilarSingerSvr',
},
};
const params = Object.assign(singerParams, {
'-': 'getSimilarSingerList1112654390871275',
data: JSON.stringify(data),
});
return await URequest({
method: 'get',
params,
thenable: res => {
if (!singerMid) {
ctx.status = 400;
ctx.body = {
message: 'no singermid',
};
return;
}
Object.assign(ctx, {
status: 200,
body: {
data: res.data,
},
});
},
catcher: error => {
console.log('error', error);
ctx.status = 400;
ctx.body = { error };
},
});
};
module.exports = {
getSimilarSingerOld: similarOld,
getSimilarSinger: similar,
};
对于先前接入的用户, 我们也做了一些兼容性的接口处理, 主要是 路由的变化 mapping, 具体可以在 routers/map-router.js
👇中体现, 感谢你的关注和使用。
const context = require('.');
module.exports = {
// INFO: singer Module
// /getSimilarSinger?singermid=0025NhlN2yWrP4
'/getSimilarSinger/:singermid?': {
cb: context.getSimilarSingerOld,
},
// /singe/similar?id=4558&singermid=0025NhlN2yWrP4
'/singer/similar/:id/:singermid/:pageNum?': {
cb: context.getSimilarSinger,
},
};
const Router = require('koa-router');
const router = new Router();
const mapRouter = require('./map-router');
Object.keys(mapRouter).forEach(key => {
if (key && mapRouter[key]) {
const { method = 'get', cb } = mapRouter[key];
router[method](key, cb);
}
});
module.exports = router;
搜索热词返回空数组,根据关键字搜索报错
Is your feature request related to a problem? Please describe.
#7
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
现在应该还不能获取收费歌曲吧,还有320k、无损格式,只能获取到128K的,如果有了登录接口,登录有绿钻的号就都能获取到了
系统:
nodejs 版本(koa2要求版本是7.6.0+):
重现步骤尽量详细,不能含糊不清
如果不是提建议,提 issues 如果不照着模版来将不会优先处理或直接关闭
文档上面写的是修改catZhida参数,但是修改了没用,我又去看了QQ音乐的链接,发现各种搜索的catZhida值都是一样的,变的是remoteplace参数,但是我用你的项目修改了这个参数返回结果还是一样的songs,希望作者能修复一下这个问题
描述下需要的是什么
/getMusicVKey?songmid=001fkWNw2eaEYT
系统:
nodejs 版本(koa2要求版本是7.6.0+):
重现步骤尽量详细,不能含糊不清
如果不是提建议,提 issues 如果不照着模版来将不会优先处理或直接关闭
不好意思哈, 因为不是很好根据模板描述, 就不按照模板来了
我想问下现在有播放歌曲的api了么? 我看了下api结构图是有的, 但是没有找到。 搜索接口返回的url 类似 "url": "http://stream10.qqmusic.qq.com/718478.wma",
这个, 直接请求的话是404
https://y.qq.com/m/client/guitar_community/smart_guitar.html?songMid=0039MnYb0qxYhV&web=1
qq音乐每首歌都会智能生成一个曲谱,如上所示。
是否可以把这个也增加到api中
感谢
qq音乐最近貌似增加了一些新的歌曲信息,如 音乐指数、当前收听、昨日收听、全站排名等,请问这些歌曲信息可以获取到吗?要在哪里获取呢?
https://user-images.githubusercontent.com/94966294/229153736-3e87e8d6-6a74-478f-82e7-04d10c39253d.jpg
https://user-images.githubusercontent.com/94966294/229153769-2c53c702-98dd-487f-b60c-7b9bff116cab.jpg
获取所有歌手列表的接口没有看到唉
建议创建个交流群,一起探讨
系统:
nodejs 版本(koa2要求版本是7.6.0+):
重现步骤尽量详细,不能含糊不清
如果不是提建议,提 issues 如果不照着模版来将不会优先处理或直接关闭
很不错的项目,谢谢作者的贡献!
我的需求是,给定一个歌曲的mid,我需要知道该歌曲的“名称”,“歌手”,“专辑“,”封面“等一系列信息(也就是搜索歌曲时返回的那些信息)。具体来说,功能类似于这个网易云api。我好像在文档里没找到相关的接口,希望能作者补充这个接口,谢谢!
比如这个歌手https://y.qq.com/n/ryqq/singer/000FzZ3q3kxTMG
希望能下载输入歌手的全部歌词 保存到csv 这样以后歌曲被和谐了歌词还能找到,
最好把能看到的那些字段全部保存下来,比如歌曲名,图片地址,专辑名,歌手名,歌曲ID等,方便搜索
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
我在API结构图看到是有的,但是在文档中并没有找到轮播图API
链接地址是这:jsososo/QQMusicApi#168
module.exports = {
'/': async ({req, res, request, globalCookie, cache}) => {
const obj = {...req.query, ...req.body};
let { uin, qqmusic_key } = globalCookie.userCookie();
if (Number(obj.ownCookie)) {
uin = req.cookies.uin || uin;
}
const {
pageNo = 1,
pageSize = 20,
key,
t = 0, // 0:单曲,2:歌单,7:歌词,8:专辑,9:歌手,12:mv
raw
} = req.query;
let total = 0;
if (!key) {
return res.send({
result: 500,
errMsg: '关键词不能为空',
});
}
// 缓存
const cacheKey = `search_${key}_${pageNo}_${pageSize}_${t}`;
const cacheData = cache.get(cacheKey);
if (cacheData) {
res && res.send(cacheData);
return cacheData;
}
const url = 'https://u.y.qq.com/cgi-bin/musicu.fcg'
const typeMap = {
0: 'song',
2: 'album',
1: 'singer',
3: 'songlist',
7: 'lyric',
12: 'mv',
};
if (!typeMap[t]) {
return res.send({
result: 500,
errMsg: '搜索类型错误,检查一下参数 t',
});
}
const params = {
req_1: {
method: "DoSearchForQQMusicDesktop",
module: "music.search.SearchCgiService",
param: {
num_per_page: Number(pageSize),
page_num: Number(pageNo),
query: key,
search_type: Number(t)
}
}
}
let result = {}
try {
result = await request({
url,
method: 'POST',
data: params,
headers: {
Referer: 'https://y.qq.com'
},
});
} catch (error) {
return res.send({
result: 400,
error
})
}
// 直接返回原生数据
if (Number(raw)) {
return res.send(result);
}
const response = {
result: 100,
data: {
list: Number(t) === 0 ? formatSongList(result.req_1.data.body[typeMap[t]].list) : result.req_1.data.body[typeMap[t]].list,
pageNo,
pageSize,
total: result.req_1.data.meta.sum,
key: result.req_1.data.meta.query || key,
t,
type: typeMap[t],
},
}
res.send(response);
},
// 热搜词
'/hot': async ({req, res, request}) => {
const {raw} = req.query;
const result = await request({
url: 'https://c.y.qq.com/splcloud/fcgi-bin/gethotkey.fcg',
});
if (Number(raw)) {
return res.send(result);
}
res.send({
result: 100,
data: result.data.hotkey,
});
},
// 快速搜索
'/quick': async ({req, res, request}) => {
const {raw, key} = req.query;
if (!key) {
return res.send({
result: 500,
errMsg: 'key ?',
});
}
const result = await request(
https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?key=${key}&g_tk=5381
,
);
if (Number(raw)) {
return res.send(result);
}
return res.send({
result: 100,
data: result.data,
});
},
}
function formatSongList(list) {
if (!Array.isArray(list)) {
return []
}
return list.map((item) => {
// 美化歌曲数据
return {
singer: item.singer, // 、
name: item.title,
songid: item.id,
songmid: item.mid,
songname: item.title,
albumid: item.album.id,
albummid: item.album.mid,
albumname: item.album.name,
interval: item.interval,
strMediaMid: item.file.media_mid,
size128: item.file.size_128mp3,
size320: item.file.size_320mp3,
sizeape: item.file.size_ape,
sizeflac: item.file.size_flac,
pay: item.pay || {}
}
})
}
Bug / Feature:
复现:
文档有提及刷新登陆接口 /user/refresh,但是没有找到.希望能补充一下~
21-08-22 🐚 新增刷新登陆 & mv 点赞 & bug fix,这个Commit提交是不是漏掉了.
Is your feature request related to a problem? Please describe.
The music info API request from issue #8 is handled perfectly! However, the new API does not support querying multi music info. Querying multi music info at once is useful when you are trying to load a bunch of music (say, a new music playlist). Querying their info one by one is time-inefficient and will easily result in the block of raw QQ API (I think :P).
Describe the solution you'd like
I want a new (or modification of the origin) API, which I can get a list of music info back. One can refer to this netease API for the detailed design :).
Thanks for the great work again!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.