diff --git a/.eslintrc.js b/.eslintrc.js index 6e8fca8..9ed61ef 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,38 +1,38 @@ module.exports = { - root: true, + root: true, - parserOptions: { - parser: 'babel-eslint', - ecmaVersion: 2018, - sourceType: 'module' - }, + parserOptions: { + parser: 'babel-eslint', + ecmaVersion: 2018, + sourceType: 'module' + }, + plugins: ['html'], + env: { + browser: true + }, - env: { - browser: true - }, - - rules: { - indent: ['error', 2, { SwitchCase: 1 }], - "space-infix-ops": ["error", {"int32Hint": false}], - 'key-spacing': [ - 2, - { - beforeColon: false, - afterColon: true - } - ], - 'no-octal': 2, - 'no-redeclare': 2, - 'comma-spacing': 2, - 'no-new-object': 2, - 'arrow-spacing': 2, - quotes: [ - 2, - 'single', - { - avoidEscape: true, - allowTemplateLiterals: true - } - ] - } + rules: { + indent: ['error', 2, { SwitchCase: 1 }], + 'space-infix-ops': ['error', { int32Hint: false }], + 'key-spacing': [ + 2, + { + beforeColon: false, + afterColon: true + } + ], + 'no-octal': 2, + 'no-redeclare': 2, + 'comma-spacing': 2, + 'no-new-object': 2, + 'arrow-spacing': 2, + quotes: [ + 2, + 'single', + { + avoidEscape: true, + allowTemplateLiterals: true + } + ] + } } diff --git a/CHANGELOG.MD b/CHANGELOG.MD index ae19412..59038e4 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,9 @@ # 更新日志 +### 3.25.3 | 2019.11.08 +- 升级依赖,去除多余依赖 + +- 优化 `test.html` + ### 3.25.2 | 2019.11.07 - 修复邮箱登录状态码错误,增加相关提示 [#633](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/633) diff --git a/docs/README.md b/docs/README.md index deadbc0..364b9dc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -269,7 +269,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api `/simi/playlist?id=347230×tamp=1503019930000` (之所以加入缓存机制是因为项目早期没有缓存机制,很多 issues 都是报 IP高频,请按自己需求改造缓存中间件(app.js),源码不复杂) !> 如果是跨域请求 , 请在所有请求带上 `xhrFields: { withCredentials: true }` (axios 为 `withCredentials: true`)否则 -可能会因为没带上 cookie 导致 301, 具体例子可看 `public/test.html`, 例子使用 jQuery 和 axios +可能会因为没带上 cookie 导致 301, 具体例子可看 `public/test.html`, 访问`http://localhost:3000/test.html`(默认端口的话) 例子使用 jQuery 和 axios !> 301 错误基本都是没登录就调用了需要登录的接口,如果登陆了还是提示 301, 基本都是缓存把数据缓存起来了,解决方法是加时间戳或者等待 2 分钟或者重启服务重新登录后再调用接口,可自行改造缓存方法 diff --git a/module/captcha_sent.js b/module/captcha_sent.js index 5066093..05d1c6a 100644 --- a/module/captcha_sent.js +++ b/module/captcha_sent.js @@ -2,7 +2,7 @@ module.exports = (query, request) => { const data = { - ctcode: query.ctcode||'86', + ctcode: query.ctcode || '86', cellphone: query.phone, } return request( diff --git a/module/captcha_verify.js b/module/captcha_verify.js index 5ba6f4d..0abe388 100644 --- a/module/captcha_verify.js +++ b/module/captcha_verify.js @@ -2,7 +2,7 @@ module.exports = (query, request) => { const data = { - ctcode: query.ctcode||'86', + ctcode: query.ctcode || '86', cellphone: query.phone, captcha: query.captcha } diff --git a/module/comment_dj.js b/module/comment_dj.js index d5269eb..cfb99e1 100644 --- a/module/comment_dj.js +++ b/module/comment_dj.js @@ -6,7 +6,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 } return request( 'POST', `https://music.163.com/weapi/v1/resource/comments/A_DJ_1_${query.id}`, data, diff --git a/module/comment_event.js b/module/comment_event.js index ecb2cf9..0548d2f 100644 --- a/module/comment_event.js +++ b/module/comment_event.js @@ -2,7 +2,7 @@ module.exports = (query, request) => { const data = { limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 }; return request( 'POST', diff --git a/module/comment_hot.js b/module/comment_hot.js index 82305cb..f2bfe0d 100644 --- a/module/comment_hot.js +++ b/module/comment_hot.js @@ -14,7 +14,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 } return request( 'POST', `https://music.163.com/weapi/v1/resource/hotcomments/${query.type}${query.id}`, data, diff --git a/module/comment_music.js b/module/comment_music.js index 76334e3..6c83086 100644 --- a/module/comment_music.js +++ b/module/comment_music.js @@ -6,7 +6,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 }; return request( 'POST', diff --git a/module/comment_mv.js b/module/comment_mv.js index 26e0fac..d6c0b76 100644 --- a/module/comment_mv.js +++ b/module/comment_mv.js @@ -6,7 +6,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 } return request( 'POST', `https://music.163.com/weapi/v1/resource/comments/R_MV_5_${query.id}`, data, diff --git a/module/comment_playlist.js b/module/comment_playlist.js index 38202a1..e0ef723 100644 --- a/module/comment_playlist.js +++ b/module/comment_playlist.js @@ -6,7 +6,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 } return request( 'POST', `https://music.163.com/weapi/v1/resource/comments/A_PL_0_${query.id}`, data, diff --git a/module/comment_video.js b/module/comment_video.js index 4d1967d..452f137 100644 --- a/module/comment_video.js +++ b/module/comment_video.js @@ -6,7 +6,7 @@ module.exports = (query, request) => { rid: query.id, limit: query.limit || 20, offset: query.offset || 0, - beforeTime: query.before|| 0 + beforeTime: query.before || 0 } return request( 'POST', `https://music.163.com/weapi/v1/resource/comments/R_VI_62_${query.id}`, data, diff --git a/module/like.js b/module/like.js index c4af4e3..f44e58a 100644 --- a/module/like.js +++ b/module/like.js @@ -2,7 +2,7 @@ const { toBoolean } = require('../util') module.exports = (query, request) => { - query.like = query.like=='false' ? false : true + query.like = query.like == 'false' ? false : true const data = { trackId: query.id, like: query.like diff --git a/module/lyric.js b/module/lyric.js index 32fdc02..a795cb8 100644 --- a/module/lyric.js +++ b/module/lyric.js @@ -1,7 +1,7 @@ // 歌词 module.exports = (query, request) => { - const data={ + const data = { id: query.id } return request( diff --git a/package.json b/package.json index b2278a8..65389a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "3.25.2", + "version": "3.25.3", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", @@ -27,18 +27,18 @@ "author": "binaryify", "license": "MIT", "dependencies": { - "apicache": "^1.4.0", - "express": "^4.16.4", - "pac-proxy-agent": "^3.0.0", + "apicache": "^1.5.2", + "express": "^4.17.1", + "pac-proxy-agent": "^3.0.1", "request": "^2.88.0" }, "devDependencies": { - "eslint": "^6.1.0", - "eslint-config-standard": "^13.0.1", - "husky": "^3.0.3", + "eslint": "^6.6.0", + "eslint-plugin-html": "^6.0.0", + "husky": "^3.0.9", "intelli-espower-loader": "^1.0.1", - "lint-staged": "^9.2.1", - "mocha": "^6.1.4", + "lint-staged": "^9.4.2", + "mocha": "^6.2.2", "power-assert": "^1.6.1" } } diff --git a/public/test.html b/public/test.html index 10e8b3c..4d30961 100644 --- a/public/test.html +++ b/public/test.html @@ -1,52 +1,58 @@ -
- - - -