diff --git a/netease_api/routes/index.js b/netease_api/routes/index.js index 8bb4377..24e747b 100644 --- a/netease_api/routes/index.js +++ b/netease_api/routes/index.js @@ -1,8812 +1,96 @@ -const { cookieToJson } = require('../util/index'); -const crypto = require('crypto'); +const { + cookieToJson +} = require('../util/index'); const request = require('../util/request'); -module.exports = { - '/yunbei/today': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_today = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/point/today/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_today(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/tasks/todo': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_tasks_todo = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/usertool/task/todo/query`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_tasks_todo(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/tasks': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_tasks = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/usertool/task/list/all`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_tasks(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/task/finish': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_task_finish = (query, request) => { - const data = { - userTaskId: query.userTaskId, - depositCode: query.depositCode || '0', - }; - return request( - 'POST', - `https://music.163.com/api/usertool/task/point/receive`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_task_finish(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/sign': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_sign = (query, request) => { - const data = { type: '0' }; - return request( - 'POST', - `https://music.163.com/api/point/dailyTask`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_sign(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/receipt': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_receipt = (query, request) => { - const data = { limit: query.limit || 10, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/store/api/point/receipt`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_receipt(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/info': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_info = (query, request) => { - const data = {}; - return request('POST', `https://music.163.com/api/v1/user/info`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - yunbei_info(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei/expense': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei_expense = (query, request) => { - const data = { limit: query.limit || 10, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/store/api/point/expense`, - data, - { - crypto: 'api', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei_expense(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/yunbei': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const yunbei = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/point/signed/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - yunbei(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/weblog': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const weblog = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/feedback/weblog`, - query.data || {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - weblog(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/url': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_url = (query, request) => { - const data = { - ids: '["' + query.id + '"]', - resolution: query.res || 1080, - }; - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/playurl`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_url(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/timeline/recommend': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_timeline_recommend = (query, request) => { - const data = { - offset: query.offset || 0, - filterLives: '[]', - withProgramInfo: 'true', - needUrl: '1', - resolution: '480', - }; - return request( - 'POST', - `https://music.163.com/api/videotimeline/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_timeline_recommend(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/timeline/all': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_timeline_all = (query, request) => { - const data = { - groupId: 0, - offset: query.offset || 0, - need_preview_url: 'true', - total: true, - }; - return request( - 'POST', - `https://music.163.com/api/videotimeline/otherclient/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_timeline_all(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/sub': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_sub = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub'; - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/video/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_sub(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/group/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_group_list = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/cloudvideo/group/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_group_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/group': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_group = (query, request) => { - const data = { - groupId: query.id, - offset: query.offset || 0, - need_preview_url: 'true', - total: true, - }; - return request( - 'POST', - `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_group(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/detail/info': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_detail_info = (query, request) => { - const data = { threadid: `R_VI_62_${query.vid}`, composeliked: true }; - return request( - 'POST', - `https://music.163.com/api/comment/commentthread/info`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_detail_info(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_detail = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/v1/video/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/video/category/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const video_category_list = (query, request) => { - const data = { - offset: query.offset || 0, - total: 'true', - limit: query.limit || 99, - }; - return request( - 'POST', - `https://music.163.com/api/cloudvideo/category/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - video_category_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_update = (query, request) => { - const data = { - avatarImgId: '0', - birthday: query.birthday, - city: query.city, - gender: query.gender, - nickname: query.nickname, - province: query.province, - signature: query.signature, - }; - return request( - 'POST', - `https://music.163.com/weapi/user/profile/update`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/subcount': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_subcount = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/subcount`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_subcount(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/replacephone': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_replacephone = (query, request) => { - const data = { - phone: query.phone, - captcha: query.captcha, - oldcaptcha: query.oldcaptcha, - countrycode: query.countrycode || '86', - }; - return request( - 'POST', - `https://music.163.com/api/user/replaceCellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_replacephone(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/record': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_record = (query, request) => { - const data = { uid: query.uid, type: query.type || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/v1/play/record`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_record(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_playlist = (query, request) => { - const data = { - uid: query.uid, - limit: query.limit || 30, - offset: query.offset || 0, - includeVideo: true, - }; - return request('POST', `https://music.163.com/api/user/playlist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - user_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/level': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_level = (query, request) => { - const data = {}; - return request('POST', `https://music.163.com/weapi/user/level`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - user_level(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/follows': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_follows = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - order: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/user/getfollows/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_follows(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/followeds': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_followeds = (query, request) => { - const data = { - userId: query.uid, - time: query.lasttime || -1, - limit: query.limit || 30, - }; - return request( - 'POST', - `https://music.163.com/eapi/user/getfolloweds/${query.uid}`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/user/getfolloweds', - realIP: query.realIP, - }, - ); - }; - user_followeds(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/event': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_event = (query, request) => { - const data = { - getcounts: true, - time: query.lasttime || -1, - limit: query.limit || 30, - total: false, - }; - return request( - 'POST', - `https://music.163.com/weapi/event/get/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_event(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/dj': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_dj = (query, request) => { - const data = { limit: query.limit || 30, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/dj/program/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_dj(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_detail = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/user/detail/${query.uid}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/cloud/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_cloud_detail = (query, request) => { - const id = query.id.replace(/\s/g, '').split(','); - const data = { songIds: id }; - return request( - 'POST', - `https://music.163.com/weapi/v1/cloud/get/byids`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_cloud_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/cloud/del': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_cloud_del = (query, request) => { - const data = { songIds: [query.id] }; - return request('POST', `https://music.163.com/weapi/cloud/del`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - user_cloud_del(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/cloud': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_cloud = (query, request) => { - const data = { limit: query.limit || 30, offset: query.offset || 0 }; - return request('POST', `https://music.163.com/weapi/v1/cloud/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - user_cloud(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/binding': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_binding = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/v1/user/bindings/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_binding(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/audio': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_audio = (query, request) => { - const data = { userId: query.uid }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/get/byuser`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_audio(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/user/account': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const user_account = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/nuser/account/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - user_account(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/toplist/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const toplist_detail = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/toplist/detail`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - toplist_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/toplist/artist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const toplist_artist = (query, request) => { - const data = { - type: query.type || 1, - limit: 100, - offset: 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/toplist/artist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - toplist_artist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/toplist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const toplist = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/toplist`, - {}, - { - crypto: 'linuxapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - toplist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/song': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_song = (query, request) => { - const data = { areaId: query.type || 0, total: true }; - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/new/songs`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - top_song(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/playlist/highquality': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_playlist_highquality = (query, request) => { - const data = { - cat: query.cat || '全部', - limit: query.limit || 50, - lasttime: query.before || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/api/playlist/highquality/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - top_playlist_highquality(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_playlist = (query, request) => { - const data = { - cat: query.cat || '全部', - order: query.order || 'hot', - limit: query.limit || 50, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/playlist/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - top_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/mv': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_mv = (query, request) => { - const data = { - area: query.area || '', - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - }; - return request('POST', `https://music.163.com/weapi/mv/toplist`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - top_mv(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_list = (query, request) => { - query.cookie.os = 'pc'; - if (query.idx) { - return Promise.resolve({ - status: 500, - body: { code: 500, msg: '不支持此方式调用,只支持id调用' }, - }); - } - const data = { id: query.id, n: '500', s: '0' }; - return request( - 'POST', - `https://interface3.music.163.com/api/playlist/v4/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - top_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/artists': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_artists = (query, request) => { - const data = { - limit: query.limit || 50, - offset: query.offset || 0, - total: true, - }; - return request('POST', `https://music.163.com/weapi/artist/top`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - top_artists(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/top/album': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const top_album = (query, request) => { - const date = new Date(); - const data = { - area: query.area || 'ALL', - limit: query.limit || 50, - offset: query.offset || 0, - type: query.type || 'new', - year: query.year || date.getFullYear(), - month: query.month || date.getMonth() + 1, - total: false, - rcmd: true, - }; - return request( - 'POST', - `https://music.163.com/api/discovery/new/albums/area`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - top_album(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/song/url': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const song_url = (query, request) => { - if (!('MUSIC_U' in query.cookie)) - query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex'); - query.cookie.os = 'pc'; - const data = { - ids: '[' + query.id + ']', - br: parseInt(query.br || 999000), - }; - return request( - 'POST', - `https://interface3.music.163.com/eapi/song/enhance/player/url`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/song/enhance/player/url', - }, - ); - }; - song_url(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/song/order/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const song_order_update = (query, request) => { - const data = { pid: query.pid, trackIds: query.ids, op: 'update' }; - return request( - 'POST', - `http://interface.music.163.com/api/playlist/manipulate/tracks`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/desc/update', - realIP: query.realIP, - }, - ); - }; - song_order_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/song/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const song_detail = (query, request) => { - query.ids = query.ids.split(/\s*,\s*/); - const data = { - c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']', - ids: '[' + query.ids.join(',') + ']', - }; - return request( - 'POST', - `https://music.163.com/weapi/v3/song/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - song_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/simi/user': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const simi_user = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiUser`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - simi_user(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/simi/song': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const simi_song = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/simiSong`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - simi_song(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/simi/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const simi_playlist = (query, request) => { - const data = { - songid: query.id, - limit: query.limit || 50, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiPlaylist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - simi_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/simi/mv': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const simi_mv = (query, request) => { - const data = { mvid: query.mvid }; - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiMV`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - simi_mv(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/simi/artist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const simi_artist = (query, request) => { - const data = { artistid: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/discovery/simiArtist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - simi_artist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/share/resource': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const share_resource = (query, request) => { - const data = { - type: query.type || 'song', - msg: query.msg || '', - id: query.id || '', - }; - return request( - 'POST', - `https://music.163.com/weapi/share/friends/resource`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - share_resource(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/setting': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const setting = (query, request) => { - const data = {}; - return request('POST', `https://music.163.com/api/user/setting`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - setting(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/send/text': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const send_text = (query, request) => { - query.cookie.os = 'pc'; - const data = { - type: 'text', - msg: query.msg, - userIds: '[' + query.user_ids + ']', - }; - return request( - 'POST', - `https://music.163.com/weapi/msg/private/send`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - send_text(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/send/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const send_playlist = (query, request) => { - query.cookie.os = 'pc'; - const data = { - id: query.playlist, - type: 'playlist', - msg: query.msg, - userIds: '[' + query.user_ids + ']', - }; - return request( - 'POST', - `https://music.163.com/weapi/msg/private/send`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - send_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search/suggest': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search_suggest = (query, request) => { - const data = { s: query.keywords || '' }; - let type = query.type == 'mobile' ? 'keyword' : 'web'; - return request( - 'POST', - `https://music.163.com/weapi/search/suggest/` + type, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - search_suggest(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search/multimatch': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search_multimatch = (query, request) => { - const data = { type: query.type || 1, s: query.keywords || '' }; - return request( - 'POST', - `https://music.163.com/weapi/search/suggest/multimatch`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - search_multimatch(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search/hot/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search_hot_detail = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/weapi/hotsearchlist/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - search_hot_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search/hot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search_hot = (query, request) => { - const data = { type: 1111 }; - return request('POST', `https://music.163.com/weapi/search/hot`, data, { - crypto: 'weapi', - ua: 'mobile', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - search_hot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search/default': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search_default = (query, request) => { - return request( - 'POST', - `https://interface3.music.163.com/eapi/search/defaultkeyword/get`, - {}, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/search/defaultkeyword/get', - realIP: query.realIP, - }, - ); - }; - search_default(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/search': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const search = (query, request) => { - const data = { - s: query.keywords, - type: query.type || 1, - limit: query.limit || 30, - offset: query.offset || 0, - }; - return request('POST', `https://music.163.com/weapi/search/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - search(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/scrobble': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const scrobble = (query, request) => { - const data = { - logs: JSON.stringify([ - { - action: 'play', - json: { - download: 0, - end: 'playend', - id: query.id, - sourceId: query.sourceid, - time: query.time, - type: 'song', - wifi: 0, - }, - }, - ]), - }; - return request( - 'POST', - `https://music.163.com/weapi/feedback/weblog`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - scrobble(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/resource/like': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const resource_like = (query, request) => { - query.cookie.os = 'pc'; - query.t = query.t == 1 ? 'like' : 'unlike'; - query.type = { 1: 'R_MV_5_', 4: 'A_DJ_1_', 5: 'R_VI_62_', 6: 'A_EV_2_' }[ - query.type - ]; - const data = { threadId: query.type + query.id }; - if (query.type === 'A_EV_2_') { - data.threadId = query.threadId; - } - return request( - 'POST', - `https://music.163.com/weapi/resource/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - resource_like(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/related/allvideo': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const related_allvideo = (query, request) => { - const data = { id: query.id, type: /^\\d+$/.test(query.id) ? 0 : 1 }; - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/v1/allvideo/rcmd`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - related_allvideo(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/register/cellphone': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const register_cellphone = (query, request) => { - query.cookie.os = 'pc'; - const data = { - captcha: query.captcha, - phone: query.phone, - password: crypto.createHash('md5').update(query.password).digest('hex'), - nickname: query.nickname, - }; - return request( - 'POST', - `https://music.163.com/api/register/cellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - register_cellphone(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/recommend/songs': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const recommend_songs = (query, request) => { - query.cookie.os = 'ios'; - const data = {}; - return request( - 'POST', - `https://music.163.com/api/v3/discovery/recommend/songs`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - recommend_songs(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/recommend/resource': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const recommend_resource = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/discovery/recommend/resource`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - recommend_resource(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/rebind': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const rebind = (query, request) => { - const data = { - captcha: query.captcha, - phone: query.phone, - oldcaptcha: query.oldcaptcha, - ctcode: query.ctcode || '86', - }; - return request( - 'POST', - `https://music.163.com/api/user/replaceCellphone`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - rebind(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/program/recommend': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const program_recommend = (query, request) => { - const data = { - cateId: query.type, - limit: query.limit || 10, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/program/recommend/v1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - program_recommend(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playmode/intelligence/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playmode_intelligence_list = (query, request) => { - const data = { - songId: query.id, - type: 'fromPlayOne', - playlistId: query.pid, - startMusicId: query.sid || query.id, - count: query.count || 1, - }; - return request( - 'POST', - `https://music.163.com/weapi/playmode/intelligence/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playmode_intelligence_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/video/recent': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_video_recent = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/playlist/video/recent`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_video_recent(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_update = (query, request) => { - query.cookie.os = 'pc'; - query.desc = query.desc || ''; - query.tags = query.tags || ''; - const data = { - '/api/playlist/desc/update': `{\"id\":${query.id},\"desc\":\"${query.desc}\"}`, - '/api/playlist/tags/update': `{\"id\":${query.id},\"tags\":\"${query.tags}\"}`, - '/api/playlist/update/name': `{\"id\":${query.id},\"name\":\"${query.name}\"}`, - }; - return request('POST', `https://music.163.com/weapi/batch`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - playlist_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/tracks': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_tracks = async (query, request) => { - query.cookie.os = 'pc'; - const tracks = query.tracks.split(','); - const data = { - op: query.op, - pid: query.pid, - trackIds: JSON.stringify(tracks), - imme: 'true', - }; - try { - const res = await request( - 'POST', - `https://music.163.com/api/playlist/manipulate/tracks`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - return { status: 200, body: { ...res } }; - } catch (error) { - if (error.body.code === 512) { - return request( - 'POST', - `https://music.163.com/api/playlist/manipulate/tracks`, - { - op: query.op, - pid: query.pid, - trackIds: JSON.stringify([...tracks, ...tracks]), - imme: 'true', - }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - } - } - }; - playlist_tracks(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/track/delete': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_track_delete = async (query, request) => { - query.cookie.os = 'pc'; - query.ids = query.ids || ''; - const data = { - id: query.id, - tracks: JSON.stringify( - query.ids.split(',').map((item) => { - return { type: 3, id: item }; - }), - ), - }; - return request( - 'POST', - `https://music.163.com/api/playlist/track/delete`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_track_delete(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/track/add': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_track_add = async (query, request) => { - query.cookie.os = 'pc'; - query.ids = query.ids || ''; - const data = { - id: query.pid, - tracks: JSON.stringify( - query.ids.split(',').map((item) => { - return { type: 3, id: item }; - }), - ), - }; - console.log(data); - return request( - 'POST', - `https://music.163.com/api/playlist/track/add`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_track_add(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/tags/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_tags_update = (query, request) => { - const data = { id: query.id, tags: query.tags }; - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/tags/update`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/tags/update', - realIP: query.realIP, - }, - ); - }; - playlist_tags_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/subscribers': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_subscribers = (query, request) => { - const data = { - id: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/playlist/subscribers`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_subscribers(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/subscribe': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_subscribe = (query, request) => { - query.t = query.t == 1 ? 'subscribe' : 'unsubscribe'; - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/playlist/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_subscribe(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/order/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_order_update = (query, request) => { - query.cookie.os = 'pc'; - const data = { ids: query.ids }; - return request( - 'POST', - `https://music.163.com/api/playlist/order/update`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_order_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/name/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_name_update = (query, request) => { - const data = { id: query.id, name: query.name }; - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/update/name`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/update/name', - realIP: query.realIP, - }, - ); - }; - playlist_name_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/mylike': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_mylike = (query, request) => { - const data = { time: query.time || '-1', limit: query.limit || '12' }; - return request( - 'POST', - `https://music.163.com/api/mlog/playlist/mylike/bytime/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_mylike(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/hot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_hot = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/playlist/hottags`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_hot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/highquality/tags': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_highquality_tags = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/playlist/highquality/tags`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_highquality_tags(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_detail = (query, request) => { - const data = { id: query.id, n: 100000, s: query.s || 8 }; - return request( - 'POST', - `https://music.163.com/api/v6/playlist/detail`, - data, - { - crypto: 'linuxapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/desc/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_desc_update = (query, request) => { - const data = { id: query.id, desc: query.desc }; - return request( - 'POST', - `https://interface3.music.163.com/eapi/playlist/desc/update`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/playlist/desc/update', - realIP: query.realIP, - }, - ); - }; - playlist_desc_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/delete': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_delete = (query, request) => { - query.cookie.os = 'pc'; - const data = { ids: '[' + query.id + ']' }; - return request( - 'POST', - `https://music.163.com/weapi/playlist/remove`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_delete(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/create': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_create = (query, request) => { - query.cookie.os = 'pc'; - const data = { - name: query.name, - privacy: query.privacy, - type: query.type || 'NORMAL', - }; - return request( - 'POST', - `https://music.163.com/api/playlist/create`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_create(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/cover/update': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_cover_update = async (query, request) => { - const uploadInfo = await uploadPlugin(query, request); - const res = await request( - 'POST', - `https://music.163.com/weapi/playlist/cover/update`, - { id: query.id, coverImgId: uploadInfo.imgId }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - return { - status: 200, - body: { code: 200, data: { ...uploadInfo, ...res.body } }, - }; - }; - playlist_cover_update(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/playlist/catlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const playlist_catlist = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/playlist/catalogue`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - playlist_catlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized/privatecontent/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized_privatecontent_list = (query, request) => { - const data = { - offset: query.offset || 0, - total: 'true', - limit: query.limit || 60, - }; - return request( - 'POST', - `https://music.163.com/api/v2/privatecontent/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized_privatecontent_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized/privatecontent': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized_privatecontent = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/privatecontent`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized_privatecontent(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized/newsong': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized_newsong = (query, request) => { - const data = { - type: 'recommend', - limit: query.limit || 10, - areaId: query.areaId || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/personalized/newsong`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized_newsong(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized/mv': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized_mv = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/mv`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized_mv(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized/djprogram': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized_djprogram = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/personalized/djprogram`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized_djprogram(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personalized': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personalized = (query, request) => { - const data = { limit: query.limit || 30, total: true, n: 1000 }; - return request( - 'POST', - `https://music.163.com/weapi/personalized/playlist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personalized(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/personal_fm': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const personal_fm = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/radio/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - personal_fm(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/url': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_url = (query, request) => { - const data = { id: query.id, r: query.r || 1080 }; - return request( - 'POST', - `https://music.163.com/weapi/song/enhance/play/mv/url`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_url(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/sublist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_sublist = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/cloudvideo/allvideo/sublist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_sublist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/sub': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_sub = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub'; - const data = { mvId: query.mvid, mvIds: '["' + query.mvid + '"]' }; - return request( - 'POST', - `https://music.163.com/weapi/mv/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_sub(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/first': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_first = (query, request) => { - const data = { - area: query.area || '', - limit: query.limit || 30, - total: true, - }; - return request( - 'POST', - `https://interface.music.163.com/weapi/mv/first`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_first(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/exclusive/rcmd': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_exclusive_rcmd = (query, request) => { - const data = { offset: query.offset || 0, limit: query.limit || 30 }; - return request( - 'POST', - `https://interface.music.163.com/api/mv/exclusive/rcmd`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_exclusive_rcmd(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/detail/info': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_detail_info = (query, request) => { - const data = { threadid: `R_MV_5_${query.mvid}`, composeliked: true }; - return request( - 'POST', - `https://music.163.com/api/comment/commentthread/info`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_detail_info(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_detail = (query, request) => { - const data = { id: query.mvid }; - return request('POST', `https://music.163.com/api/v1/mv/detail`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - mv_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/mv/all': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const mv_all = (query, request) => { - const data = { - tags: JSON.stringify({ - 地区: query.area || '全部', - 类型: query.type || '全部', - 排序: query.order || '上升最快', - }), - offset: query.offset || 0, - total: 'true', - limit: query.limit || 30, - }; - return request( - 'POST', - `https://interface.music.163.com/api/mv/all`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - mv_all(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/msg/private/history': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const msg_private_history = (query, request) => { - const data = { - userId: query.uid, - limit: query.limit || 30, - time: query.before || 0, - total: 'true', - }; - return request( - 'POST', - `https://music.163.com/api/msg/private/history`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - msg_private_history(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/msg/private': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const msg_private = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - total: 'true', - }; - return request( - 'POST', - `https://music.163.com/api/msg/private/users`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - msg_private(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/msg/notices': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const msg_notices = (query, request) => { - const data = { limit: query.limit || 30, time: query.lasttime || -1 }; - return request('POST', `https://music.163.com/api/msg/notices`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - msg_notices(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/msg/forwards': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const msg_forwards = (query, request) => { - const data = { - offset: query.offset || 0, - limit: query.limit || 30, - total: 'true', - }; - return request('POST', `https://music.163.com/api/forwards/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - msg_forwards(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/msg/comments': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const msg_comments = (query, request) => { - const data = { - beforeTime: query.before || '-1', - limit: query.limit || 30, - total: 'true', - uid: query.uid, - }; - return request( - 'POST', - `https://music.163.com/api/v1/user/comments/${query.uid}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - msg_comments(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/lyric': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const lyric = (query, request) => { - query.cookie.os = 'pc'; - const data = { id: query.id, lv: -1, kv: -1, tv: -1 }; - return request('POST', `https://music.163.com/api/song/lyric`, data, { - crypto: 'linuxapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - lyric(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/logout': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const logout = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/logout`, - {}, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - logout(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/login/status': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const login_status = (query, request) => { - return request( - 'GET', - `https://music.163.com`, - {}, - { cookie: query.cookie, proxy: query.proxy, realIP: query.realIP }, - ).then((response) => { - try { - let profile = eval( - `(${/GUser\\s*=\\s*([^;]+);/.exec(response.body)[1]})`, - ); - let bindings = eval( - `(${/GBinds\\s*=\\s*([^;]+);/.exec(response.body)[1]})`, - ); - response.body = { code: 200, profile: profile, bindings: bindings }; - return response; - } catch (err) { - response.status = 301; - response.body = { code: 301 }; - return Promise.reject(response); - } - }); - }; - login_status(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/login/refresh': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const login_refresh = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/login/token/refresh`, - {}, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - login_refresh(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/login/cellphone': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const login_cellphone = async (query, request) => { - query.cookie.os = 'pc'; - const data = { - phone: query.phone, - countrycode: query.countrycode || '86', - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true', - }; - let result = await request( - 'POST', - `https://music.163.com/weapi/login/cellphone`, - data, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - if (result.body.code === 200) { - result = { - status: 200, - body: { ...result.body, cookie: result.cookie.join(';') }, - cookie: result.cookie, - }; - } - return result; - }; - login_cellphone(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/login': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const login = async (query, request) => { - query.cookie.os = 'pc'; - const data = { - username: query.email, - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), - rememberLogin: 'true', - }; - let result = await request( - 'POST', - `https://music.163.com/weapi/login`, - data, - { - crypto: 'weapi', - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - if (result.body.code === 502) { - return { - status: 200, - body: { msg: '账号或密码错误', code: 502, message: '账号或密码错误' }, - }; - } - if (result.body.code === 200) { - result = { - status: 200, - body: { ...result.body, cookie: result.cookie.join(';') }, - cookie: result.cookie, - }; - } - return result; - }; - login(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/likelist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const likelist = (query, request) => { - const data = { uid: query.uid }; - return request( - 'POST', - `https://music.163.com/weapi/song/like/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - likelist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/like': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const like = (query, request) => { - query.cookie.os = 'pc' - query.cookie.appver = '2.7.1.198277' - query.like = query.like == 'false' ? false : true - const data = { - alg: 'itembased', - trackId: query.id, - like: query.like, - time: '3', - } - return request('POST', `https://music.163.com/api/radio/like`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }) - } +const clc = require('cli-color'); - like(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/hot/topic': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const hot_topic = (query, request) => { - const data = { limit: query.limit || 20, offset: query.offset || 0 }; - return request('POST', `https://music.163.com/weapi/act/hot`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - hot_topic(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/homepage/dragon/ball': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const homepage_dragon_ball = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/eapi/homepage/dragon/ball/static`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/homepage/dragon/ball/static', - realIP: query.realIP, - }, - ); - }; - homepage_dragon_ball(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/homepage/block/page': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const homepage_block_page = (query, request) => { - const data = { refresh: query.refresh || true }; - return request( - 'POST', - `https://music.163.com/api/homepage/block/page`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - homepage_block_page(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/history/recommend/songs/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const history_recommend_songs_detail = (query, request) => { - query.cookie.os = 'ios'; - const data = { date: query.date || '' }; - return request( - 'POST', - `https://music.163.com/api/discovery/recommend/songs/history/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - history_recommend_songs_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/history/recommend/songs': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const history_recommend_songs = (query, request) => { - query.cookie.os = 'ios'; - const data = {}; - return request( - 'POST', - `https://music.163.com/api/discovery/recommend/songs/history/recent`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - history_recommend_songs(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/follow': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const follow = (query, request) => { - query.cookie.os = 'pc'; - query.t = query.t == 1 ? 'follow' : 'delfollow'; - return request( - 'POST', - `https://music.163.com/weapi/user/${query.t}/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - follow(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/fm_trash': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const fm_trash = (query, request) => { - const data = { songId: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/radio/trash/add?alg=RT&songId=${ - query.id - }&time=${query.time || 25}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - fm_trash(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/event/forward': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const event_forward = (query, request) => { - query.cookie.os = 'pc'; - const data = { - forwards: query.forwards, - id: query.evId, - eventUserId: query.uid, - }; - return request( - 'POST', - `https://music.163.com/weapi/event/forward`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - event_forward(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/event/del': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const event_del = (query, request) => { - const data = { id: query.evId }; - return request('POST', `https://music.163.com/eapi/event/delete`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - event_del(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/event': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const event = (query, request) => { - const data = { - pagesize: query.pagesize || 20, - lasttime: query.lasttime || -1, - }; - return request('POST', `https://music.163.com/weapi/v1/event/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - event(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/toplist/popular': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_toplist_popular = (query, request) => { - const data = { limit: query.limit || 100 }; - return request( - 'POST', - `https://music.163.com/api/dj/toplist/popular`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_toplist_popular(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/toplist/pay': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_toplist_pay = (query, request) => { - const data = { limit: query.limit || 100 }; - return request( - 'POST', - `https://music.163.com/api/djradio/toplist/pay`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_toplist_pay(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/toplist/newcomer': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_toplist_newcomer = (query, request) => { - const data = { limit: query.limit || 100, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/api/dj/toplist/newcomer`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_toplist_newcomer(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/toplist/hours': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_toplist_hours = (query, request) => { - const data = { limit: query.limit || 100 }; - return request( - 'POST', - `https://music.163.com/api/dj/toplist/hours`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_toplist_hours(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/toplist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_toplist = (query, request) => { - const data = { - limit: query.limit || 100, - offset: query.offset || 0, - type: typeMap[query.type || 'new'] || '0', - }; - return request( - 'POST', - `https://music.163.com/api/djradio/toplist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_toplist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/today/perfered': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_today_perfered = (query, request) => { - const data = { page: query.page || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/today/perfered`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_today_perfered(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/subscriber': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_subscriber = (query, request) => { - const data = { - time: query.time || '-1', - id: query.id, - limit: query.limit || '20', - total: 'true', - }; - return request( - 'POST', - `https://music.163.com/api/djradio/subscriber`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_subscriber(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/sublist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_sublist = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/get/subed`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_sublist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/sub': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_sub = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub'; - const data = { id: query.rid }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_sub(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/recommend/type': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_recommend_type = (query, request) => { - const data = { cateId: query.type }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/recommend`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_recommend_type(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/recommend': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_recommend = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/recommend/v1`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_recommend(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/radio/hot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_radio_hot = (query, request) => { - const data = { - cateId: query.cateId, - limit: query.limit || 30, - offset: query.offset || 0, - }; - return request('POST', `https://music.163.com/api/djradio/hot`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - dj_radio_hot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/program/toplist/hours': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_program_toplist_hours = (query, request) => { - const data = { limit: query.limit || 100 }; - return request( - 'POST', - `https://music.163.com/api/djprogram/toplist/hours`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_program_toplist_hours(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/program/toplist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_program_toplist = (query, request) => { - const data = { limit: query.limit || 100, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/api/program/toplist/v1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_program_toplist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/program/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_program_detail = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/api/dj/program/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_program_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/program': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_program = (query, request) => { - const data = { - radioId: query.rid, - limit: query.limit || 30, - offset: query.offset || 0, - asc: toBoolean(query.asc), - }; - return request( - 'POST', - `https://music.163.com/weapi/dj/program/byradio`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_program(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/personalize/recommend': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_personalize_recommend = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/djradio/personalize/rcmd`, - { limit: query.limit || 6 }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_personalize_recommend(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/paygift': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_paygift = (query, request) => { - const data = { limit: query.limit || 30, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/paygift/list?_nmclfl=1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_paygift(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/hot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_hot = (query, request) => { - const data = { limit: query.limit || 30, offset: query.offset || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/djradio/hot/v1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_hot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_detail = (query, request) => { - const data = { id: query.rid }; - return request('POST', `https://music.163.com/api/djradio/v2/get`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - dj_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/catelist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_catelist = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/category/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_catelist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/category/recommend': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_category_recommend = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/home/category/recommend`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_category_recommend(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/category/excludehot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_category_excludehot = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/djradio/category/excludehot`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_category_excludehot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/dj/banner': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const dj_banner = (query, request) => { - const data = {}; - query.cookie.os = 'pc'; - return request( - 'POST', - `https://music.163.com/weapi/djradio/banner/get`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - dj_banner(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/digitalAlbum/purchased': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const digitalAlbum_purchased = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/api/digitalAlbum/purchased`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - digitalAlbum_purchased(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/digitalAlbum/ordering': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const digitalAlbum_ordering = (query, request) => { - const data = { - business: 'Album', - paymentMethod: query.payment, - digitalResources: JSON.stringify([ - { business: 'Album', resourceID: query.id, quantity: query.quantity }, - ]), - from: 'web', - }; - return request( - 'POST', - `https://music.163.com/api/ordering/web/digital`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - digitalAlbum_ordering(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/daily_signin': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const daily_signin = (query, request) => { - const data = { type: query.type || 0 }; - return request( - 'POST', - `https://music.163.com/weapi/point/dailyTask`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - daily_signin(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/countries/code/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const countries_code_list = (query, request) => { - const data = {}; - return request( - 'POST', - `https://interface3.music.163.com/eapi/lbs/countries/v1`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/lbs/countries/v1', - realIP: query.realIP, - }, - ); - }; - countries_code_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/video': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_video = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_VI_62_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_video(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_playlist = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/A_PL_0_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/new': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_new = (query, request) => { - query.cookie.os = 'pc'; - query.type = { - 0: 'R_SO_4_', - 1: 'R_MV_5_', - 2: 'A_PL_0_', - 3: 'R_AL_3_', - 4: 'A_DJ_1_', - 5: 'R_VI_62_', - 6: 'A_EV_2_', - }[query.type]; - const threadId = query.type + query.id; - const pageSize = query.pageSize || 20; - const pageNo = query.pageNo || 1; - const data = { - threadId: threadId, - pageNo, - showInner: query.showInner || true, - pageSize, - cursor: - +query.sortType === 3 ? query.cursor || '0' : (pageNo - 1) * pageSize, - sortType: query.sortType || 1, - }; - return request( - 'POST', - `https://music.163.com/api/v2/resource/comments`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/v2/resource/comments', - }, - ); - }; - comment_new(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/mv': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_mv = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_MV_5_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_mv(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/music': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_music = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/api/v1/resource/comments/R_SO_4_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_music(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/like': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_like = (query, request) => { - query.cookie.os = 'pc'; - query.t = query.t == 1 ? 'like' : 'unlike'; - query.type = { - 0: 'R_SO_4_', - 1: 'R_MV_5_', - 2: 'A_PL_0_', - 3: 'R_AL_3_', - 4: 'A_DJ_1_', - 5: 'R_VI_62_', - 6: 'A_EV_2_', - }[query.type]; - const data = { threadId: query.type + query.id, commentId: query.cid }; - if (query.type == 'A_EV_2_') { - data.threadId = query.threadId; - } - return request( - 'POST', - `https://music.163.com/weapi/v1/comment/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_like(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/hotwall/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_hotwall_list = (query, request) => { - const data = {}; - return request( - 'POST', - `https://music.163.com/api/comment/hotwall/list/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_hotwall_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/hot': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_hot = (query, request) => { - query.cookie.os = 'pc'; - query.type = { - 0: 'R_SO_4_', - 1: 'R_MV_5_', - 2: 'A_PL_0_', - 3: 'R_AL_3_', - 4: 'A_DJ_1_', - 5: 'R_VI_62_', - }[query.type]; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/hotcomments/${query.type}${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_hot(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/floor': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_floor = (query, request) => { - query.type = { - 0: 'R_SO_4_', - 1: 'R_MV_5_', - 2: 'A_PL_0_', - 3: 'R_AL_3_', - 4: 'A_DJ_1_', - 5: 'R_VI_62_', - }[query.type]; - const data = { - parentCommentId: query.parentCommentId, - threadId: query.type + query.id, - time: query.time || -1, - limit: query.limit || 20, - }; - return request( - 'POST', - `https://music.163.com/api/resource/comment/floor/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_floor(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/event': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_event = (query, request) => { - const data = { - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/${query.threadId}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_event(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/dj': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_dj = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_dj(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment/album': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment_album = (query, request) => { - query.cookie.os = 'pc'; - const data = { - rid: query.id, - limit: query.limit || 20, - offset: query.offset || 0, - beforeTime: query.before || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/v1/resource/comments/R_AL_3_${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment_album(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/comment': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const comment = (query, request) => { - query.cookie.os = 'pc'; - query.t = { 1: 'add', 0: 'delete', 2: 'reply' }[query.t]; - query.type = { - 0: 'R_SO_4_', - 1: 'R_MV_5_', - 2: 'A_PL_0_', - 3: 'R_AL_3_', - 4: 'A_DJ_1_', - 5: 'R_VI_62_', - 6: 'A_EV_2_', - }[query.type]; - const data = { threadId: query.type + query.id }; - if (query.type == 'A_EV_2_') { - data.threadId = query.threadId; - } - if (query.t == 'add') data.content = query.content; - else if (query.t == 'delete') data.commentId = query.commentId; - else if (query.t == 'reply') { - data.commentId = query.commentId; - data.content = query.content; - } - return request( - 'POST', - `https://music.163.com/weapi/resource/comments/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - comment(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/cloudsearch': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const cloudsearch = (query, request) => { - const data = { - s: query.keywords, - type: query.type || 1, - limit: query.limit || 30, - offset: query.offset || 0, - }; - return request( - 'POST', - `https://music.163.com/weapi/cloudsearch/get/web`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - cloudsearch(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/check/music': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const check_music = (query, request) => { - const data = { - ids: '[' + parseInt(query.id) + ']', - br: parseInt(query.br || 999000), - }; - return request( - 'POST', - `https://music.163.com/weapi/song/enhance/player/url`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ).then((response) => { - let playable = false; - if (response.body.code == 200) { - if (response.body.data[0].code == 200) { - playable = true; - } - } - if (playable) { - response.body = { success: true, message: 'ok' }; - return response; - } else { - response.status = 404; - response.body = { success: false, message: '亲爱的,暂无版权' }; - return Promise.reject(response); - } - }); - }; - check_music(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/cellphone/existence/check': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const cellphone_existence_check = (query, request) => { - const data = { cellphone: query.phone, countrycode: query.countrycode }; - return request( - 'POST', - `https://music.163.com/eapi/cellphone/existence/check`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - url: '/api/cellphone/existence/check', - realIP: query.realIP, - }, - ); - }; - cellphone_existence_check(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/captcha/verify': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const captcha_verify = (query, request) => { - const data = { - ctcode: query.ctcode || '86', - cellphone: query.phone, - captcha: query.captcha, - }; - return request( - 'POST', - `https://music.163.com/weapi/sms/captcha/verify`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - captcha_verify(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/captcha/sent': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const captcha_sent = (query, request) => { - const data = { ctcode: query.ctcode || '86', cellphone: query.phone }; - return request( - 'POST', - `https://music.163.com/weapi/sms/captcha/sent`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - captcha_sent(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/calendar': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const calendar = (query, request) => { - const data = { - startTime: query.startTime || Date.now(), - endTime: query.endTime || Date.now(), - }; - return request( - 'POST', - `https://music.163.com/api/mcalendar/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - calendar(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/banner': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const banner = (query, request) => { - const type = - { 0: 'pc', 1: 'android', 2: 'iphone', 3: 'ipad' }[query.type || 0] || - 'pc'; - return request( - 'POST', - `https://music.163.com/api/v2/banner/get`, - { clientType: type }, - { crypto: 'linuxapi', proxy: query.proxy, realIP: query.realIP }, - ); - }; - banner(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/avatar/upload': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const avatar_upload = async (query, request) => { - const uploadInfo = await uploadPlugin(query, request); - const res = await request( - 'POST', - `https://music.163.com/weapi/user/avatar/upload/v1`, - { imgid: uploadInfo.imgId }, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - return { - status: 200, - body: { code: 200, data: { ...uploadInfo, ...res.body } }, - }; - }; - avatar_upload(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/audio/match': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const audio_match = (query, request) => { - query.cookie.os = 'pc'; - const data = { - algorithmCode: 'shazam_v2', - times: 1, - sessionId: 'C999431ACDC84EDBB984763654E6F8D7', - duration: 3.3066249999999995, - from: 'recognize-song', - rawdata: realData, - }; - return request( - 'POST', - `https://music.163.com/api/music/audio/match`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - audio_match(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artists': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artists = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/artist/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artists(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/top/song': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_top_song = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/api/artist/top/song`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_top_song(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/sublist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_sublist = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/artist/sublist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_sublist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/sub': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_sub = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub'; - const data = { artistId: query.id, artistIds: '[' + query.id + ']' }; - return request( - 'POST', - `https://music.163.com/weapi/artist/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_sub(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/songs': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_songs = (query, request) => { - query.cookie.os = 'pc'; - const data = { - id: query.id, - private_cloud: 'true', - work_type: 1, - order: query.order || 'hot', - offset: query.offset || 0, - limit: query.limit || 100, - }; - return request( - 'POST', - `https://music.163.com/api/v1/artist/songs`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_songs(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/mv': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_mv = (query, request) => { - const data = { - artistId: query.id, - limit: query.limit, - offset: query.offset, - total: true, - }; - return request('POST', `https://music.163.com/weapi/artist/mvs`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - artist_mv(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_list = (query, request) => { - const data = { - initial: isNaN(query.initial) - ? (query.initial || '').toUpperCase().charCodeAt() || undefined - : query.initial, - offset: query.offset || 0, - limit: query.limit || 30, - total: true, - type: query.type || '1', - area: query.area, - }; - return request('POST', `https://music.163.com/api/v1/artist/list`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - artist_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/desc': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_desc = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/artist/introduction`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_desc(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/artist/album': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const artist_album = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/artist/albums/${query.id}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - artist_album(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/sublist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_sublist = (query, request) => { - const data = { - limit: query.limit || 25, - offset: query.offset || 0, - total: true, - }; - return request( - 'POST', - `https://music.163.com/weapi/album/sublist`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_sublist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/sub': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_sub = (query, request) => { - query.t = query.t == 1 ? 'sub' : 'unsub'; - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/api/album/${query.t}`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_sub(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/songsaleboard': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_songsaleboard = (query, request) => { - let data = { albumType: query.albumType || 0 }; - const type = query.type || 'daily'; - if (type === 'year') { - data = { ...data, year: query.year }; - } - return request( - 'POST', - `https://music.163.com/api/feealbum/songsaleboard/${type}/type`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_songsaleboard(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/newest': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_newest = (query, request) => { - return request( - 'POST', - `https://music.163.com/api/discovery/newAlbum`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_newest(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/new': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_new = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - area: query.area || 'ALL', - }; - return request('POST', `https://music.163.com/weapi/album/new`, data, { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }); - }; - album_new(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/list/style': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_list_style = (query, request) => { - const data = { - limit: query.limit || 10, - offset: query.offset || 0, - total: true, - area: query.area || 'Z_H', - }; - return request( - 'POST', - `https://music.163.com/weapi/vipmall/appalbum/album/style`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_list_style(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/list': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_list = (query, request) => { - const data = { - limit: query.limit || 30, - offset: query.offset || 0, - total: true, - area: query.area || 'ALL', - type: query.type, - }; - return request( - 'POST', - `https://music.163.com/weapi/vipmall/albumproduct/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_list(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/detail/dynamic': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_detail_dynamic = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/api/album/detail/dynamic`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_detail_dynamic(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album/detail': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album_detail = (query, request) => { - const data = { id: query.id }; - return request( - 'POST', - `https://music.163.com/weapi/vipmall/albumproduct/detail`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album_detail(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/album': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const album = (query, request) => { - return request( - 'POST', - `https://music.163.com/weapi/v1/album/${query.id}`, - {}, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ); - }; - album(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/activate/init/profile': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const activate_init_profile = (query, request) => { - const data = { nickname: query.nickname }; - return request( - 'POST', - `https://music.163.com/eapi/activate/initProfile`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/activate/initProfile', - }, - ); - }; - activate_init_profile(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, - '/related/playlist': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const related_playlist = (query, request) => { - return request( - 'GET', - `https://music.163.com/playlist?id=${query.id}`, - {}, - { - ua: 'pc', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ).then((response) => { - try { - const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g; - let result, - playlists = []; - while ((result = pattern.exec(response.body)) != null) { - playlists.push({ - creator: { - userId: result[4].slice('/user/home?id='.length), - nickname: result[5], - }, - coverImgUrl: result[1].slice(0, -'?param=50y50'.length), - name: result[3], - id: result[2].slice('/playlist?id='.length), - }); - } - response.body = { code: 200, playlists: playlists }; - return response; - } catch (err) { - response.status = 500; - response.body = { code: 500, msg: err.stack }; - return Promise.reject(response); - } - }); - }; - related_playlist(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, +const table = { + // 注意 /album 这样的路由必须放在 /album/new 这样的路由后面 + '/top/playlist/highquality': require('../module/top_playlist_highquality'), + '/album/detail/dynamic': require('../module/album_detail_dynamic'), + '/recommend/resource': require('../module/recommend_resource'), + '/playlist/subscribe': require('../module/playlist_subscribe'), + '/playlist/catlist': require('../module/playlist_catlist'), + '/playlist/detail': require('../module/playlist_detail'), + '/login/cellphone': require('../module/login_cellphone'), + '/playlist/delete': require('../module/playlist_delete'), + '/playlist/create': require('../module/playlist_create'), + '/playlist/tracks': require('../module/playlist_tracks'), + '/recommend/songs': require('../module/recommend_songs'), + '/toplist/artist': require('../module/toplist_artist'), + '/artist/sublist': require('../module/artist_sublist'), + '/login/refresh': require('../module/login_refresh'), + '/user/playlist': require('../module/user_playlist'), + '/album/sublist': require('../module/album_sublist'), + '/artist/album': require('../module/artist_album'), + '/personalized': require('../module/personalized'), + '/top/playlist': require('../module/top_playlist'), + '/user/account': require('../module/user_account'), + '/daily_signin': require('../module/daily_signin'), + '/simi/artist': require('../module/simi_artist'), + '/song/detail': require('../module/song_detail'), + '/user/detail': require('../module/user_detail'), + '/personal_fm': require('../module/personal_fm'), + '/artist/sub': require('../module/artist_sub'), + '/mv/sublist': require('../module/mv_sublist'), + '/user/cloud': require('../module/user_cloud'), + '/album/new': require('../module/album_new'), + '/album/sub': require('../module/album_sub'), + '/mv/detail': require('../module/mv_detail'), + '/artist/mv': require('../module/artist_mv'), + '/song/url': require('../module/song_url'), + '/top/song': require('../module/top_song'), + '/scrobble': require('../module/scrobble'), + '/likelist': require('../module/likelist'), + '/fm_trash': require('../module/fm_trash'), + '/artists': require('../module/artists'), + '/simi/mv': require('../module/simi_mv'), + '/toplist': require('../module/toplist'), + '/logout': require('../module/logout'), + '/mv/url': require('../module/mv_url'), + '/mv/sub': require('../module/mv_sub'), + '/search': require('../module/search'), + '/lyric': require('../module/lyric'), + '/cloud': require('../module/cloud'), + '/album': require('../module/album'), + '/login': require('../module/login'), + '/like': require('../module/like'), +} - '/batch': (req, res) => { - if (typeof req.query.cookie === 'string') { - req.query.cookie = cookieToJson(req.query.cookie); - } - let query = Object.assign( - {}, - { cookie: req.cookies }, - req.query, - req.body, - req.files, - ); - const batch = (query, request) => { - const data = { - e_r: true, - }; - Object.keys(query).forEach((i) => { - if (/^\/api\//.test(i)) { - data[i] = query[i]; - } +const handleRequest = (req, res, func) => { + if (typeof req.query.cookie === 'string') { + req.query.cookie = cookieToJson(req.query.cookie); + } + let query = Object.assign( + {}, + { cookie: req.cookies }, + req.query, + req.body, + req.files, + ) + return func(query, request) + .then((answer) => { + console.log(`${clc.redBright('[NetEase API]')} OK, ${decodeURIComponent(req.originalUrl)}`); + res.append('Set-Cookie', answer.cookie); + res.status(answer.status).send(answer.body); + }) + .catch((answer) => { + console.log(`${clc.redBright('[NetEase API]')} ERROR 🚫 `, decodeURIComponent(req.originalUrl), { + status: answer.status, + body: answer.body, }); - return request('POST', `https://music.163.com/eapi/batch`, data, { - crypto: 'eapi', - proxy: query.proxy, - url: '/api/batch', - cookie: query.cookie, - realIP: query.realIP, - }); - }; - batch(query, request) - .then((answer) => { - console.log('[OK]', decodeURIComponent(req.originalUrl)); - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }) - .catch((answer) => { - console.log('[ERR]', decodeURIComponent(req.originalUrl), { - status: answer.status, - body: answer.body, - }); - if (answer.body.code == '301') answer.body.msg = '需要登录'; - res.append('Set-Cookie', answer.cookie); - res.status(answer.status).send(answer.body); - }); - }, + if (answer.body.code == '301') answer.body.msg = '需要登录'; + res.append('Set-Cookie', answer.cookie); + res.status(answer.status).send(answer.body); + }); +} + +let defaultExport = {}; + +for (const [route, func] of Object.entries(table)) { + defaultExport[route] = (req, res) => { + return handleRequest(req, res, func); + }; }; + +export default defaultExport; diff --git a/package.json b/package.json index a9203fe..ac43384 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@revincx/unblockneteasemusic": "^0.25.7", "axios": "^0.21.0", "change-case": "^4.1.2", + "cli-color": "^2.0.0", "core-js": "^3.6.5", "crypto-js": "^4.0.0", "dayjs": "^1.8.36", diff --git a/src/api/playlist.js b/src/api/playlist.js index 078b064..b1b9a84 100644 --- a/src/api/playlist.js +++ b/src/api/playlist.js @@ -196,7 +196,7 @@ export function addOrRemoveTrackFromPlaylist(params) { export function dailyRecommendTracks() { return request({ url: '/recommend/songs', - method: 'post', + method: 'get', params: { timestamp: new Date().getTime() }, }).then(result => { result.data.dailySongs = mapTrackPlayableStatus( diff --git a/src/electron/services.js b/src/electron/services.js index c538bf2..fe611b3 100644 --- a/src/electron/services.js +++ b/src/electron/services.js @@ -3,6 +3,7 @@ const bodyParser = require('body-parser'); const cache = require('../../netease_api/util/apicache').middleware; const fileUpload = require('express-fileupload'); import routes from '../../netease_api/routes'; +const clc = require('cli-color'); export function startNeteaseMusicApi() { // Integrate API @@ -53,6 +54,10 @@ export function startNeteaseMusicApi() { const host = process.env.HOST || '127.0.0.1'; app.server = app.listen(port, host, () => { - console.log(`server running @ http://${host ? host : 'localhost'}:${port}`); + console.log( + `${clc.redBright('[NetEase API]')} server running @ http://${ + host ? host : 'localhost' + }:${port}` + ); }); } diff --git a/yarn.lock b/yarn.lock index c8c8921..6700d6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2118,7 +2118,7 @@ ansi-html@0.0.7: resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= -ansi-regex@^2.0.0: +ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= @@ -3276,6 +3276,18 @@ cli-boxes@^2.2.1: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== +cli-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.0.tgz#11ecfb58a79278cf6035a60c54e338f9d837897c" + integrity sha512-a0VZ8LeraW0jTuCkuAGMNufareGHhyZU9z8OGsW0gXd1hZGi1SRuNRXdbGkraBBKnhyUhyebFWnRbp+dIn0f0A== + dependencies: + ansi-regex "^2.1.1" + d "^1.0.1" + es5-ext "^0.10.51" + es6-iterator "^2.0.3" + memoizee "^0.4.14" + timers-ext "^0.1.7" + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -3997,6 +4009,14 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -4774,16 +4794,52 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.51, es5-ext@^0.10.53, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.3" + next-tick "~1.0.0" + es6-error@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== +es6-iterator@^2.0.3, es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + es6-promise@^4.0.3, es6-promise@^4.1.1: version "4.2.8" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== +es6-symbol@^3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -4992,6 +5048,14 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= + dependencies: + d "1" + es5-ext "~0.10.14" + event-pubsub@4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/event-pubsub/-/event-pubsub-4.3.0.tgz#f68d816bc29f1ec02c539dc58c8dd40ce72cb36e" @@ -5169,6 +5233,13 @@ ext-name@^5.0.0: ext-list "^2.0.0" sort-keys-length "^1.0.0" +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" + extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -6846,6 +6917,11 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-promise@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== + is-regex@^1.0.4, is-regex@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.2.tgz#81c8ebde4db142f2cf1c53fc86d6a45788266251" @@ -7525,6 +7601,13 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM= + dependencies: + es5-ext "~0.10.2" + make-dir@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -7583,6 +7666,20 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= +memoizee@^0.4.14: + version "0.4.15" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" + integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-weak-map "^2.0.3" + event-emitter "^0.3.5" + is-promise "^2.2.2" + lru-queue "^0.1.0" + next-tick "^1.1.0" + timers-ext "^0.1.7" + memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -7979,6 +8076,16 @@ netmask@^2.0.1: resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== +next-tick@1, next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -11153,6 +11260,14 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +timers-ext@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== + dependencies: + es5-ext "~0.10.46" + next-tick "1" + timm@^1.6.1: version "1.7.1" resolved "https://registry.yarnpkg.com/timm/-/timm-1.7.1.tgz#96bab60c7d45b5a10a8a4d0f0117c6b7e5aff76f" @@ -11349,6 +11464,16 @@ type-is@~1.6.17, type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.0.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" + integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"