From ab37ff328ddc14db6ce035d4ebdec93bc5e1f46a Mon Sep 17 00:00:00 2001 From: YXL Date: Thu, 1 Oct 2020 22:28:06 +0800 Subject: [PATCH 1/7] use `axios` to replace `request` --- package-lock.json | 290 +++------------------------------------------- package.json | 3 +- util/request.js | 28 +++-- 3 files changed, 33 insertions(+), 288 deletions(-) diff --git a/package-lock.json b/package-lock.json index 028eaf2..c80ab5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -337,6 +337,7 @@ "version": "6.12.4", "resolved": "https://registry.npm.taobao.org/ajv/download/ajv-6.12.4.tgz?cache=0&sync_timestamp=1597480759610&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.4.tgz", "integrity": "sha1-BhT6zEUiEn+nE0Rca/0+vTduIjQ=", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -442,19 +443,6 @@ "is-string": "^1.0.4" } }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npm.taobao.org/asn1/download/asn1-0.2.4.tgz", - "integrity": "sha1-jSR136tVO7M+d7VOWeiAu4ziMTY=", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, "ast-types": { "version": "0.13.4", "resolved": "https://registry.npm.taobao.org/ast-types/download/ast-types-0.13.4.tgz?cache=0&sync_timestamp=1598279472396&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fast-types%2Fdownload%2Fast-types-0.13.4.tgz", @@ -469,21 +457,6 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npm.taobao.org/aws-sign2/download/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npm.taobao.org/aws4/download/aws4-1.10.1.tgz?cache=0&sync_timestamp=1597236947743&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faws4%2Fdownload%2Faws4-1.10.1.tgz", - "integrity": "sha1-4eguTz6Zniz9YbFhKA0WoRH4ZCg=" - }, "axios": { "version": "0.20.0", "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.20.0.tgz?cache=0&sync_timestamp=1597979633356&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.20.0.tgz", @@ -498,14 +471,6 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, "binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npm.taobao.org/binary-extensions/download/binary-extensions-2.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbinary-extensions%2Fdownload%2Fbinary-extensions-2.1.0.tgz", @@ -597,11 +562,6 @@ "integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA=", "dev": true }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npm.taobao.org/caseless/download/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, "chalk": { "version": "4.1.0", "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", @@ -822,14 +782,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.8.tgz", - "integrity": "sha1-w9RaizT9cwYxoRCoolIGgrMdWn8=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", @@ -925,14 +877,6 @@ "type": "^1.0.1" } }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "data-uri-to-buffer": { "version": "3.0.1", "resolved": "https://registry.npm.taobao.org/data-uri-to-buffer/download/data-uri-to-buffer-3.0.1.tgz?cache=0&sync_timestamp=1590800007667&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdata-uri-to-buffer%2Fdownload%2Fdata-uri-to-buffer-3.0.1.tgz", @@ -954,7 +898,7 @@ }, "dedent": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "resolved": "https://registry.npm.taobao.org/dedent/download/dedent-0.7.0.tgz", "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", "dev": true }, @@ -996,11 +940,6 @@ "esprima": "^4.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "depd": { "version": "1.1.2", "resolved": "https://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz", @@ -1092,15 +1031,6 @@ "integrity": "sha1-aWzi7Aqg5uqTo5f/zySqeEDIJ8s=", "dev": true }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npm.taobao.org/ecc-jsbn/download/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz", @@ -1813,20 +1743,11 @@ } } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz", - "integrity": "sha1-+LETa0Bx+9jrFAr/hYsQGewpFfo=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599697571&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz", - "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=" + "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=", + "dev": true }, "fast-diff": { "version": "1.2.0", @@ -1851,7 +1772,8 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz?cache=0&sync_timestamp=1576340291001&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-json-stable-stringify%2Fdownload%2Ffast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=" + "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -1963,21 +1885,6 @@ "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.13.0.tgz?cache=0&sync_timestamp=1597057976909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.13.0.tgz", "integrity": "sha1-tC6Nk6Kn7qXtiGM2dtZZe8jjhNs=" }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npm.taobao.org/forever-agent/download/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npm.taobao.org/form-data/download/form-data-2.3.3.tgz", - "integrity": "sha1-3M5SwF9kTymManq5Nr1yTO/786Y=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz", @@ -2087,14 +1994,6 @@ } } }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npm.taobao.org/getpass/download/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npm.taobao.org/glob/download/glob-7.1.6.tgz?cache=0&sync_timestamp=1573078121947&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob%2Fdownload%2Fglob-7.1.6.tgz", @@ -2152,20 +2051,6 @@ "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npm.taobao.org/har-schema/download/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npm.taobao.org/har-validator/download/har-validator-5.1.5.tgz?cache=0&sync_timestamp=1596082584903&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhar-validator%2Fdownload%2Fhar-validator-5.1.5.tgz", - "integrity": "sha1-HwgDufjLIMD6E4It8ezds2veHv0=", - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npm.taobao.org/has/download/has-1.0.3.tgz", @@ -2242,16 +2127,6 @@ } } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npm.taobao.org/http-signature/download/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "https-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npm.taobao.org/https-proxy-agent/download/https-proxy-agent-5.0.0.tgz?cache=0&sync_timestamp=1581106803611&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttps-proxy-agent%2Fdownload%2Fhttps-proxy-agent-5.0.0.tgz", @@ -2456,7 +2331,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npm.taobao.org/is-obj/download/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -2477,7 +2352,7 @@ }, "is-regexp": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/is-regexp/download/is-regexp-1.0.0.tgz", "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", "dev": true }, @@ -2508,11 +2383,6 @@ "has-symbols": "^1.0.1" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npm.taobao.org/is-typedarray/download/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, "is-url": { "version": "1.2.4", "resolved": "https://registry.npm.taobao.org/is-url/download/is-url-1.2.4.tgz", @@ -2530,11 +2400,6 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, "iterate-iterator": { "version": "1.0.1", "resolved": "https://registry.npm.taobao.org/iterate-iterator/download/iterate-iterator-1.0.1.tgz", @@ -2567,26 +2432,17 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npm.taobao.org/json-parse-even-better-errors/download/json-parse-even-better-errors-2.3.1.tgz?cache=0&sync_timestamp=1599064788298&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson-parse-even-better-errors%2Fdownload%2Fjson-parse-even-better-errors-2.3.1.tgz", "integrity": "sha1-fEeAWpQxmSjgV3dAXcEuH3pO4C0=", "dev": true }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npm.taobao.org/json-schema/download/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz?cache=0&sync_timestamp=1599333856086&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson-schema-traverse%2Fdownload%2Fjson-schema-traverse-0.4.1.tgz", - "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=" + "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=", + "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -2594,11 +2450,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npm.taobao.org/json-stringify-safe/download/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz", @@ -2607,17 +2458,6 @@ "graceful-fs": "^4.1.6" } }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npm.taobao.org/jsprim/download/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, "levn": { "version": "0.3.0", "resolved": "https://registry.npm.taobao.org/levn/download/levn-0.3.0.tgz", @@ -3070,11 +2910,6 @@ "path-key": "^3.0.0" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz", - "integrity": "sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU=" - }, "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npm.taobao.org/object-inspect/download/object-inspect-1.8.0.tgz?cache=0&sync_timestamp=1592545231350&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fobject-inspect%2Fdownload%2Fobject-inspect-1.8.0.tgz", @@ -3305,11 +3140,6 @@ "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npm.taobao.org/picomatch/download/picomatch-2.2.2.tgz?cache=0&sync_timestamp=1584790434095&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpicomatch%2Fdownload%2Fpicomatch-2.2.2.tgz", @@ -3510,11 +3340,6 @@ "ipaddr.js": "1.9.1" } }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npm.taobao.org/psl/download/psl-1.8.0.tgz", - "integrity": "sha1-kyb4vPsBOtzABf3/BWrM4CDlHCQ=" - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -3528,7 +3353,8 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz", - "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=" + "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=", + "dev": true }, "qs": { "version": "6.7.0", @@ -3596,40 +3422,6 @@ "integrity": "sha1-IG0K0KVkjP+9uK5GQ489xRyfeOI=", "dev": true }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npm.taobao.org/request/download/request-2.88.2.tgz", - "integrity": "sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM=", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz", - "integrity": "sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=" - } - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz", @@ -3888,22 +3680,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npm.taobao.org/sshpk/download/sshpk-1.16.1.tgz", - "integrity": "sha1-+2YcC+8ps520B2nuOfpwCT1vaHc=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz?cache=0&sync_timestamp=1587327902535&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstatuses%2Fdownload%2Fstatuses-1.5.0.tgz", @@ -4045,7 +3821,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -4063,15 +3839,6 @@ "resolved": "https://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz", "integrity": "sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM=" }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.5.0.tgz?cache=0&sync_timestamp=1584646121003&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftough-cookie%2Fdownload%2Ftough-cookie-2.5.0.tgz", - "integrity": "sha1-zZ+yoKodWhK0c72fuW+j3P9lreI=", - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, "traverse": { "version": "0.6.6", "resolved": "https://registry.npm.taobao.org/traverse/download/traverse-0.6.6.tgz", @@ -4100,19 +3867,6 @@ } } }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz?cache=0&sync_timestamp=1581364203962&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftweetnacl%2Fdownload%2Ftweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, "type": { "version": "1.2.0", "resolved": "https://registry.npm.taobao.org/type/download/type-1.2.0.tgz?cache=0&sync_timestamp=1598016585110&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftype%2Fdownload%2Ftype-1.2.0.tgz", @@ -4179,6 +3933,7 @@ "version": "4.4.0", "resolved": "https://registry.npm.taobao.org/uri-js/download/uri-js-4.4.0.tgz?cache=0&sync_timestamp=1598814377097&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Furi-js%2Fdownload%2Furi-js-4.4.0.tgz", "integrity": "sha1-qnFCYd55PoqCNHp7zJznTobyhgI=", + "dev": true, "requires": { "punycode": "^2.1.0" } @@ -4188,11 +3943,6 @@ "resolved": "https://registry.npm.taobao.org/utils-merge/download/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1595886641252&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz", - "integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=" - }, "v8-compile-cache": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", @@ -4204,16 +3954,6 @@ "resolved": "https://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npm.taobao.org/verror/download/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "which": { "version": "2.0.2", "resolved": "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz?cache=0&sync_timestamp=1574116720213&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwhich%2Fdownload%2Fwhich-2.0.2.tgz", @@ -4231,7 +3971,7 @@ }, "which-pm-runs": { "version": "1.0.0", - "resolved": "https://registry.npm.taobao.org/which-pm-runs/download/which-pm-runs-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", "dev": true }, diff --git a/package.json b/package.json index 5673e12..179ed63 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,7 @@ "axios": "^0.20.0", "express": "^4.17.1", "express-fileupload": "^1.1.9", - "pac-proxy-agent": "^4.0.0", - "request": "^2.88.0" + "pac-proxy-agent": "^4.0.0" }, "devDependencies": { "@types/node": "14.11.2", diff --git a/util/request.js b/util/request.js index f7a5523..ea949f0 100644 --- a/util/request.js +++ b/util/request.js @@ -1,8 +1,10 @@ const encrypt = require('./crypto') -const request = require('request') +const axios = require('axios') const queryString = require('querystring') const PacProxyAgent = require('pac-proxy-agent') const zlib = require('zlib') +const http = require('http') +const https = require('https') // request.debug = true // 开启可看到更详细信息 @@ -114,23 +116,23 @@ const createRequest = (method, url, data, options) => { method: method, url: url, headers: headers, - body: queryString.stringify(data), + data: queryString.stringify(data), + httpAgent: new http.Agent({ keepAlive: true }), + httpsAgent: new https.Agent({ keepAlive: true }), } if (options.crypto === 'eapi') settings.encoding = null if (/\.pac$/i.test(options.proxy)) { - settings.agent = new PacProxyAgent(options.proxy) + settings.httpAgent = new PacProxyAgent(options.proxy) + settings.httpsAgent = new PacProxyAgent(options.proxy) } else { settings.proxy = options.proxy } - request(settings, (err, res, body) => { - if (err) { - answer.status = 502 - answer.body = { code: 502, msg: err.stack } - reject(answer) - } else { + axios(settings) + .then((res) => { + const body = res.data answer.cookie = (res.headers['set-cookie'] || []).map((x) => x.replace(/\s*Domain=[^(;|$)]+;*/, ''), ) @@ -172,8 +174,12 @@ const createRequest = (method, url, data, options) => { 100 < answer.status && answer.status < 600 ? answer.status : 400 if (answer.status == 200) resolve(answer) else reject(answer) - } - }) + }) + .catch((err) => { + answer.status = 502 + answer.body = { code: 502, msg: err } + reject(answer) + }) }) } From 8b529e55f0d3fb977020998202e37c5dbac13380 Mon Sep 17 00:00:00 2001 From: YXL Date: Thu, 1 Oct 2020 22:29:30 +0800 Subject: [PATCH 2/7] fix key spell --- main.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.d.ts b/main.d.ts index 0ae4168..14954a5 100644 --- a/main.d.ts +++ b/main.d.ts @@ -34,7 +34,7 @@ declare module 'NeteaseCloudMusicApi' { export const enum SubAction { sub = 1, - ubsub = 0, + unsub = 0, } export function activate_init_profile( From cea20242881bd926ab142cd6e9f28cd19c9a8078 Mon Sep 17 00:00:00 2001 From: YXL Date: Thu, 1 Oct 2020 23:23:02 +0800 Subject: [PATCH 3/7] fix parameters error --- util/request.js | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/util/request.js b/util/request.js index ea949f0..af2db70 100644 --- a/util/request.js +++ b/util/request.js @@ -2,7 +2,6 @@ const encrypt = require('./crypto') const axios = require('axios') const queryString = require('querystring') const PacProxyAgent = require('pac-proxy-agent') -const zlib = require('zlib') const http = require('http') const https = require('https') @@ -137,37 +136,14 @@ const createRequest = (method, url, data, options) => { x.replace(/\s*Domain=[^(;|$)]+;*/, ''), ) try { - if (options.crypto === 'eapi') { - zlib.unzip(body, function (err, buffer) { - const _buffer = err ? body : buffer - try { - try { - answer.body = JSON.parse(encrypt.decrypt(_buffer).toString()) - answer.status = answer.body.code || res.statusCode - } catch (e) { - answer.body = JSON.parse(_buffer.toString()) - answer.status = res.statusCode - } - } catch (e) { - answer.body = _buffer.toString() - answer.status = res.statusCode - } - answer.status = - 100 < answer.status && answer.status < 600 ? answer.status : 400 - if (answer.status === 200) resolve(answer) - else reject(answer) - }) - return false - } else { - answer.body = JSON.parse(body) - answer.status = answer.body.code || res.statusCode - if (answer.body.code === 502) { - answer.status = 200 - } + answer.body = body + answer.status = answer.body.code || res.status + if (answer.body.code === 502) { + answer.status = 200 } } catch (e) { answer.body = body - answer.status = res.statusCode + answer.status = res.status } answer.status = From 57e5e0f5e57e7e61cc856a771062db306dd72bf2 Mon Sep 17 00:00:00 2001 From: YXL Date: Thu, 1 Oct 2020 23:23:18 +0800 Subject: [PATCH 4/7] test: use axios --- app.test.js | 2 -- test/album.test.js | 20 ++++++++++++-------- test/comment.test.js | 20 ++++++++++++-------- test/login.test.js | 26 ++++++++++++++------------ test/lyric.test.js | 20 ++++++++++++-------- test/music_url.test.js | 20 ++++++++++++-------- test/search.test.js | 20 ++++++++++++-------- 7 files changed, 74 insertions(+), 54 deletions(-) diff --git a/app.test.js b/app.test.js index 2a9e22a..94846b2 100644 --- a/app.test.js +++ b/app.test.js @@ -1,12 +1,10 @@ const fs = require('fs') const path = require('path') -const request = require('request') let app before(() => { app = require('./app.js') global.host = 'http://localhost:' + app.server.address().port - request.debug = false }) after((done) => { app.server.close(done) diff --git a/test/album.test.js b/test/album.test.js index 4709d85..2a6a1b9 100644 --- a/test/album.test.js +++ b/test/album.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' describe('测试获取歌手专辑列表是否正常', () => { @@ -8,14 +8,18 @@ describe('测试获取歌手专辑列表是否正常', () => { id: 32311, } - request.get({ url: `${host}/album`, qs: qs }, (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(body.code === 200) + axios + .get(`${host}/album`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + assert(data.code === 200) + } done() - } else { + }) + .catch((err) => { done(err) - } - }) + }) }) }) diff --git a/test/comment.test.js b/test/comment.test.js index 1637068..612f670 100644 --- a/test/comment.test.js +++ b/test/comment.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' describe('测试获取评论是否正常', () => { @@ -8,14 +8,18 @@ describe('测试获取评论是否正常', () => { id: 32311, } - request.get({ url: `${host}/comment/album`, qs: qs }, (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(body.code === 200) + axios + .get(`${host}/comment/album`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + assert(data.code === 200) + } done() - } else { + }) + .catch((err) => { done(err) - } - }) + }) }) }) diff --git a/test/login.test.js b/test/login.test.js index d1c3109..6e13a62 100644 --- a/test/login.test.js +++ b/test/login.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' console.log('注意: 测试登录需在 test/login.test.js 中填写账号密码!!!') @@ -12,18 +12,20 @@ describe('测试登录是否正常', () => { password: process.env.NCM_API_TEST_LOGIN_PASSWORD || password || '', } - request.get( - { url: `${host}/login/cellphone`, qs: qs }, - (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(body.code === 200) - console.log('昵称:' + body.profile.nickname) + axios + .get(`${host}/login/cellphone`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + console.log('昵称:' + data.profile.nickname) + assert(data.code === 200) done() - } else { - done('登录错误') } - }, - ) + done('登录错误') + }) + .catch((err) => { + done(err) + }) }) }) diff --git a/test/lyric.test.js b/test/lyric.test.js index 7d3451b..41886e4 100644 --- a/test/lyric.test.js +++ b/test/lyric.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' describe('测试获取歌词是否正常', () => { @@ -8,14 +8,18 @@ describe('测试获取歌词是否正常', () => { id: 347230, } - request.get({ url: `${host}/lyric`, qs: qs }, (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(typeof body.lrc !== 'undefined') + axios + .get(`${host}/lyric`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + assert(typeof data.lrc !== 'undefined') + } done() - } else { + }) + .catch((err) => { done(err) - } - }) + }) }) }) diff --git a/test/music_url.test.js b/test/music_url.test.js index 8661ac8..cf7777c 100644 --- a/test/music_url.test.js +++ b/test/music_url.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' describe('测试获取歌曲是否正常', () => { @@ -9,14 +9,18 @@ describe('测试获取歌曲是否正常', () => { br: 999000, } - request.get({ url: `${host}/song/url`, qs: qs }, (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(!!body.data[0].url) + axios + .get(`${host}/song/url`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + assert(!!data.data[0].url) + } done() - } else { + }) + .catch((err) => { done(err) - } - }) + }) }) }) diff --git a/test/search.test.js b/test/search.test.js index 89c62e1..e80dea5 100644 --- a/test/search.test.js +++ b/test/search.test.js @@ -1,5 +1,5 @@ const assert = require('assert') -const request = require('request') +const axios = require('axios') const host = global.host || 'http://localhost:3000' describe('测试搜索是否正常', () => { @@ -8,14 +8,18 @@ describe('测试搜索是否正常', () => { keywords: '海阔天空', type: 1, } - request.get({ url: `${host}/search`, qs: qs }, (err, res, body) => { - if (!err && res.statusCode == 200) { - body = JSON.parse(body) - assert(body.result.songs[0].name === '海阔天空') + axios + .get(`${host}/search`, { + params: qs, + }) + .then(({ status, data }) => { + if (status == 200) { + assert(data.result.songs[0].name === '海阔天空') + } done() - } else { + }) + .catch((err) => { done(err) - } - }) + }) }) }) From f6319c8b6e7c642a01ce26f0d7e9e572d165d5f0 Mon Sep 17 00:00:00 2001 From: YXL Date: Thu, 1 Oct 2020 23:26:53 +0800 Subject: [PATCH 5/7] fix login test error --- test/login.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/login.test.js b/test/login.test.js index 6e13a62..d10da4b 100644 --- a/test/login.test.js +++ b/test/login.test.js @@ -21,8 +21,9 @@ describe('测试登录是否正常', () => { console.log('昵称:' + data.profile.nickname) assert(data.code === 200) done() + } else { + done('登录错误') } - done('登录错误') }) .catch((err) => { done(err) From a58780460a3691818063db9c8aa44f096a764d5b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 2 Oct 2020 02:16:03 +0000 Subject: [PATCH 6/7] chore(deps): update dependency typescript to v4.0.3 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index c80ab5a..a945d6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3903,9 +3903,9 @@ "dev": true }, "typescript": { - "version": "4.0.2", - "resolved": "https://registry.npm.taobao.org/typescript/download/typescript-4.0.2.tgz?cache=0&sync_timestamp=1599806990215&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypescript%2Fdownload%2Ftypescript-4.0.2.tgz", - "integrity": "sha1-fqfIh3fHI8aB4zv3mIvl0AjQWsI=", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz", + "integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==", "dev": true }, "universal-deep-strict-equal": { diff --git a/package.json b/package.json index 179ed63..f800d0b 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,6 @@ "mocha": "8.1.3", "power-assert": "1.6.1", "prettier": "2.1.2", - "typescript": "4.0.2" + "typescript": "4.0.3" } } From c59ee695041d3b1c61bfaf25189c06165fa9fa77 Mon Sep 17 00:00:00 2001 From: binaryify Date: Fri, 2 Oct 2020 10:17:38 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=94=99=E5=88=AB=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 4 +- docs/README.md | 106 ++++++++++++++++++++++++------------------------- docs/v2.md | 44 ++++++++++---------- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index e5c3e88..7d9a808 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -391,14 +391,14 @@ ### 2.20.3 | 2018.09.26 -- 增加退出登陆接口 +- 增加退出登录接口 - 修正 /check/music 的检查逻辑 - 优化 Cookies 设置 - 重构单元测试 [by @nondanee](https://github.com/nondanee) -- 增加 301 需要登陆提示信息 +- 增加 301 需要登录提示信息 - 更新文档 diff --git a/docs/README.md b/docs/README.md index f5ee379..cdc2312 100644 --- a/docs/README.md +++ b/docs/README.md @@ -321,14 +321,14 @@ $ sudo docker run -d -p 3000:3000 netease-music-api !> 为使用方便,降低门槛, 文档示例接口直接使用了 GET 请求,本项目同时支持 GET/POST 请按实际需求使用 (POST请求url必须添加时间戳,使每次请求url不一样,不然请求会被缓存) -!> 由于接口做了缓存处理 ( 缓存 2 分钟,不缓存数据极容易引起网易服务器高频ip错误 , 可在 app.js 设置 , 可能会导致登陆后获取不到 cookie), **相同的 url** 会在两分钟内只向网易服务器发一次请求 , 如果遇到不需要缓 +!> 由于接口做了缓存处理 ( 缓存 2 分钟,不缓存数据极容易引起网易服务器高频ip错误 , 可在 app.js 设置 , 可能会导致登录后获取不到 cookie), **相同的 url** 会在两分钟内只向网易服务器发一次请求 , 如果遇到不需要缓 存结果的接口 , 可在请求 url 后面加一个时间戳参数使 url 不同 , 例子 : `/simi/playlist?id=347230×tamp=1503019930000` (之所以加入缓存机制是因为项目早期没有缓存机制,很多 issues 都是报 IP高频,请按自己需求改造缓存中间件(app.js),源码不复杂) !> 如果是跨域请求 , 请在所有请求带上 `xhrFields: { withCredentials: true }` (axios 为 `withCredentials: true`)否则 可能会因为没带上 cookie 导致 301, 具体例子可看 `public/test.html`, 访问`http://localhost:3000/test.html`(默认端口的话) 例子使用 jQuery 和 axios -!> 301 错误基本都是没登录就调用了需要登录的接口,如果登陆了还是提示 301, 基本都是缓存把数据缓存起来了,解决方法是加时间戳或者等待 2 分钟或者重启服务重新登录后再调用接口,可自行改造缓存方法 +!> 301 错误基本都是没登录就调用了需要登录的接口,如果登录了还是提示 301, 基本都是缓存把数据缓存起来了,解决方法是加时间戳或者等待 2 分钟或者重启服务重新登录后再调用接口,可自行改造缓存方法 !> 部分接口如登录接口不能调用太频繁 , 否则可能会触发 503 错误或者 ip 高频错误 ,若需频繁调用 , 需要准备 IP 代理池 (更新:已加入缓存机制,但仍需注意). @@ -358,7 +358,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api **可选参数 :** -`countrycode`: 国家码,用于国外手机号登陆,例如美国传入:`1` +`countrycode`: 国家码,用于国外手机号登录,例如美国传入:`1` `md5_password`: md5加密后的密码,传入后 `password` 将失效 @@ -503,7 +503,7 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 ### 获取用户详情 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户详情 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户详情 **必选参数 :** `uid` : 用户 id @@ -513,7 +513,7 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 ### 获取用户信息 , 歌单,收藏,mv, dj 数量 -说明 : 登陆后调用此接口 , 可以获取用户信息 +说明 : 登录后调用此接口 , 可以获取用户信息 **接口地址 :** `/user/subcount` @@ -521,7 +521,7 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 ### 获取用户等级信息 -说明 : 登陆后调用此接口 , 可以获取用户等级信息,包含当前登陆天数,听歌次数,下一等级需要的登录天数和听歌次数,当前等级进度,对应 https://music.163.com/#/user/level +说明 : 登录后调用此接口 , 可以获取用户等级信息,包含当前登录天数,听歌次数,下一等级需要的登录天数和听歌次数,当前等级进度,对应 https://music.163.com/#/user/level **接口地址 :** `/user/level` @@ -529,7 +529,7 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 ### 更新用户信息 -说明 : 登陆后调用此接口 , 传入相关信息,可以更新用户信息 +说明 : 登录后调用此接口 , 传入相关信息,可以更新用户信息 **必选参数 :** @@ -552,7 +552,7 @@ signature:用户签名 **调用例子 :** `/user/update?gender=0&signature=测试签名&city=440300&nickname=binary&birthday=1525918298004&province=440000` ### 更新头像 -说明 : 登陆后调用此接口,使用`'Content-Type': 'multipart/form-data'`上传图片formData(name为'imgFile'),可更新头像(参考:https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/public/avatar_update.html) +说明 : 登录后调用此接口,使用`'Content-Type': 'multipart/form-data'`上传图片formData(name为'imgFile'),可更新头像(参考:https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/public/avatar_update.html) **可选参数 :** @@ -572,7 +572,7 @@ signature:用户签名 ### 获取用户歌单 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户歌单 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户歌单 **必选参数 :** `uid` : 用户 id @@ -591,7 +591,7 @@ signature:用户签名 ### 更新歌单 -说明 : 登陆后调用此接口,可以更新用户歌单 +说明 : 登录后调用此接口,可以更新用户歌单 **必选参数 :** @@ -610,7 +610,7 @@ tags:歌单tag ,多个用 `;` 隔开,只能用官方规定标签 **调用例子 :** `/playlist/update?id=24381616&name=新歌单&desc=描述&tags=欧美` ### 更新歌单描述 -说明 : 登陆后调用此接口,可以单独更新用户歌单描述 +说明 : 登录后调用此接口,可以单独更新用户歌单描述 **必选参数 :** ``` @@ -624,7 +624,7 @@ desc:歌单描述 **调用例子 :** `/playlist/desc/update?id=24381616&desc=描述` ### 更新歌单名 -说明 : 登陆后调用此接口,可以单独更新用户歌单名 +说明 : 登录后调用此接口,可以单独更新用户歌单名 **必选参数 :** @@ -639,7 +639,7 @@ name: 歌单名 **调用例子 :** `/playlist/name/update?id=24381616&name=歌单名` ### 更新歌单标签 -说明 : 登陆后调用此接口,可以单独更新用户歌单标签 +说明 : 登录后调用此接口,可以单独更新用户歌单标签 **必选参数 :** @@ -655,7 +655,7 @@ tags: 歌单标签 ### 歌单封面上传 -说明 : 登陆后调用此接口,使用`'Content-Type': 'multipart/form-data'`上传图片formData(name为'imgFile'),可更新歌单封面(参考:https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/public/playlist_cover_update.html) +说明 : 登录后调用此接口,使用`'Content-Type': 'multipart/form-data'`上传图片formData(name为'imgFile'),可更新歌单封面(参考:https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/public/playlist_cover_update.html) **必选参数 :** `id`: 歌单id 3143833470 @@ -673,7 +673,7 @@ tags: 歌单标签 ### 调整歌单顺序 -说明 : 登陆后调用此接口,可以根据歌单id顺序调整歌单顺序 +说明 : 登录后调用此接口,可以根据歌单id顺序调整歌单顺序 **必选参数 :** @@ -685,7 +685,7 @@ tags: 歌单标签 **调用例子 :** `/playlist/order/update?ids=[111,222]` ### 调整歌曲顺序 -说明 : 登陆后调用此接口,可以根据歌曲id顺序调整歌曲顺序 +说明 : 登录后调用此接口,可以根据歌曲id顺序调整歌曲顺序 **必选参数 :** @@ -699,7 +699,7 @@ tags: 歌单标签 ### 获取用户电台 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户电台 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户电台 **必选参数 :** `uid` : 用户 id @@ -709,7 +709,7 @@ tags: 歌单标签 ### 获取用户关注列表 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户关注列表 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户关注列表 **必选参数 :** `uid` : 用户 id @@ -725,7 +725,7 @@ tags: 歌单标签 ### 获取用户粉丝列表 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户粉丝列表 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户粉丝列表 **必选参数 :** `uid` : 用户 id @@ -740,7 +740,7 @@ tags: 歌单标签 ### 获取用户动态 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户动态 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户动态 **必选参数 :** `uid` : 用户 id @@ -765,7 +765,7 @@ tags: 歌单标签 ``` ### 转发用户动态 -说明 : 登陆后调用此接口 ,可以转发用户动态 +说明 : 登录后调用此接口 ,可以转发用户动态 **必选参数 :** `uid` : 用户 id @@ -779,7 +779,7 @@ tags: 歌单标签 ### 删除用户动态 -说明 : 登陆后调用此接口 ,可以删除用户动态 +说明 : 登录后调用此接口 ,可以删除用户动态 **必选参数 :** `evId` : 动态 id @@ -788,7 +788,7 @@ tags: 歌单标签 **调用例子 :** `/event/del?evId=6712917601` ### 分享歌曲、歌单、mv、电台、电台节目到动态 -说明 : 登陆后调用此接口 ,可以分享歌曲、歌单、mv、电台、电台节目到动态 +说明 : 登录后调用此接口 ,可以分享歌曲、歌单、mv、电台、电台节目到动态 **必选参数 :** `id` : 资源 id (歌曲,歌单,mv,电台,电台节目对应 id) @@ -802,7 +802,7 @@ tags: 歌单标签 ### 获取动态评论 -说明 : 登陆后调用此接口 , 可以获取动态下评论 +说明 : 登录后调用此接口 , 可以获取动态下评论 **必选参数 :** `threadId` : 动态 id,可通过 `/event`,`/user/event` 接口获取 @@ -812,7 +812,7 @@ tags: 歌单标签 ### 关注/取消关注用户 -说明 : 登陆后调用此接口 , 传入用户 id, 和操作 t,可关注/取消关注用户 +说明 : 登录后调用此接口 , 传入用户 id, 和操作 t,可关注/取消关注用户 **必选参数 :** @@ -826,7 +826,7 @@ tags: 歌单标签 ### 获取用户播放记录 -说明 : 登陆后调用此接口 , 传入用户 id, 可获取用户播放记录 +说明 : 登录后调用此接口 , 传入用户 id, 可获取用户播放记录 **必选参数 :** `uid` : 用户 id @@ -1950,7 +1950,7 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具 **调用例子 :** `/top/album?offset=0&limit=30&year=2019&month=6` ### 全部新碟 -说明 : 登陆后调用此接口 ,可获取全部新碟 +说明 : 登录后调用此接口 ,可获取全部新碟 **可选参数 :** @@ -2294,7 +2294,7 @@ type : 地区 ### 云盘 -说明 : 登陆后调用此接口 , 可获取云盘数据 , 获取的数据没有对应 url, 需要再调用一 +说明 : 登录后调用此接口 , 可获取云盘数据 , 获取的数据没有对应 url, 需要再调用一 次 `/song/url` 获取 url **可选参数 :** @@ -2308,7 +2308,7 @@ type : 地区 **调用例子 :** `/user/cloud` ### 云盘数据详情 -说明 : 登陆后调用此接口 , 传入云盘歌曲 id,可获取云盘数据详情 +说明 : 登录后调用此接口 , 传入云盘歌曲 id,可获取云盘数据详情 **必选参数 :** `id`: 歌曲id,可多个,用逗号隔开 @@ -2318,7 +2318,7 @@ type : 地区 ### 云盘歌曲删除 -说明 : 登陆后调用此接口 , 可删除云盘歌曲 +说明 : 登录后调用此接口 , 可删除云盘歌曲 **必选参数 :** `id`: 歌曲id,可多个,用逗号隔开 @@ -2367,7 +2367,7 @@ type : 地区 ### 电台 - 节目榜 -说明 : 登陆后调用此接口 , 可获得电台节目榜 +说明 : 登录后调用此接口 , 可获得电台节目榜 **可选参数 :** @@ -2438,7 +2438,7 @@ type : 地区 ### 电台 - 新晋电台榜/热门电台榜 -说明 : 登陆后调用此接口 , 可获得新晋电台榜/热门电台榜 +说明 : 登录后调用此接口 , 可获得新晋电台榜/热门电台榜 **可选参数 :** @@ -2468,7 +2468,7 @@ type : 地区 ### 电台 - 推荐 -说明 : 登陆后调用此接口 , 可获得推荐电台 +说明 : 登录后调用此接口 , 可获得推荐电台 **接口地址 :** `/dj/recommend` @@ -2476,7 +2476,7 @@ type : 地区 ### 电台 - 分类 -说明 : 登陆后调用此接口 , 可获得电台类型 +说明 : 登录后调用此接口 , 可获得电台类型 **接口地址 :** `/dj/catelist` @@ -2484,7 +2484,7 @@ type : 地区 ### 电台 - 分类推荐 -说明 : 登陆后调用此接口 , 传入分类,可获得对应类型电台列表 +说明 : 登录后调用此接口 , 传入分类,可获得对应类型电台列表 **必选参数 :** `type`: 电台类型 , 数字 , 可通过`/dj/catelist`获取 , 对应关系为 id 对应 此接口的 type, name 对应类型 @@ -2495,7 +2495,7 @@ id 对应 此接口的 type, name 对应类型 ### 电台 - 订阅 -说明 : 登陆后调用此接口 , 传入`rid`, 可订阅 dj,dj 的 `rid` 可通过搜索指定 +说明 : 登录后调用此接口 , 传入`rid`, 可订阅 dj,dj 的 `rid` 可通过搜索指定 type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` **必选参数 :** `rid`: 电台 的 id @@ -2507,7 +2507,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台的订阅列表 -说明 : 登陆后调用此接口 , 可获取订阅的电台列表 +说明 : 登录后调用此接口 , 可获取订阅的电台列表 **接口地址 :** `/dj/sublist` @@ -2529,7 +2529,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 非热门类型 -说明 : 登陆后调用此接口, 可获得电台非热门类型 +说明 : 登录后调用此接口, 可获得电台非热门类型 **接口地址 :** `/dj/category/excludehot` @@ -2538,7 +2538,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 推荐类型 -说明 : 登陆后调用此接口, 可获得电台推荐类型 +说明 : 登录后调用此接口, 可获得电台推荐类型 **接口地址 :** `/dj/category/recommend` @@ -2547,7 +2547,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 今日优选 -说明 : 登陆后调用此接口, 可获得电台今日优选 +说明 : 登录后调用此接口, 可获得电台今日优选 **接口地址 :** `/dj/today/perfered` @@ -2556,7 +2556,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 详情 -说明 : 登陆后调用此接口 , 传入`rid`, 可获得对应电台的详情介绍 +说明 : 登录后调用此接口 , 传入`rid`, 可获得对应电台的详情介绍 **必选参数 :** `rid`: 电台 的 id @@ -2566,7 +2566,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 节目 -说明 : 登陆后调用此接口 , 传入`rid`, 可查看对应电台的电台节目以及对应的 id, 需要 +说明 : 登录后调用此接口 , 传入`rid`, 可查看对应电台的电台节目以及对应的 id, 需要 注意的是这个接口返回的 mp3Url 已经无效 , 都为 null, 但是通过调用 `/song/url` 这 个接口 , 传入节目 id 仍然能获取到节目音频 , 如 `/song/url?id=478446370` 获取代 码时间的一个节目的音频 @@ -2596,7 +2596,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 通知 - 私信 -说明 : 登陆后调用此接口 ,可获取私信 +说明 : 登录后调用此接口 ,可获取私信 **可选参数 :** @@ -2610,7 +2610,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 发送私信 -说明 : 登陆后调用此接口 , 传入用户 id 和要发送的信息, 可以发送私信,返回内容为历史私信,包含带歌单的私信信息(注:不能发送私信给自己) +说明 : 登录后调用此接口 , 传入用户 id 和要发送的信息, 可以发送私信,返回内容为历史私信,包含带歌单的私信信息(注:不能发送私信给自己) **必选参数 :** @@ -2624,7 +2624,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 私信内容 -说明 : 登陆后调用此接口 , 可获取私信内容 +说明 : 登录后调用此接口 , 可获取私信内容 **必选参数 :** `uid` : 用户 id @@ -2642,7 +2642,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 发送私信(带歌单) -说明 : 登陆后调用此接口 , 传入用户 id 和要发送的信息和歌单 id, 可以发送带歌单的私信(注:不能发送重复的歌单) +说明 : 登录后调用此接口 , 传入用户 id 和要发送的信息和歌单 id, 可以发送带歌单的私信(注:不能发送重复的歌单) **必选参数 :** @@ -2657,7 +2657,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 通知 - 评论 -说明 : 登陆后调用此接口 ,可获取评论 +说明 : 登录后调用此接口 ,可获取评论 **必选参数 :** `uid`: 用户 的 id,只能和登录账号的 id 一致 @@ -2674,7 +2674,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 通知 - @我 -说明 : 登陆后调用此接口 ,可获取@我数据 +说明 : 登录后调用此接口 ,可获取@我数据 **可选参数 :** @@ -2689,7 +2689,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 通知 - 通知 -说明 : 登陆后调用此接口 ,可获取通知 +说明 : 登录后调用此接口 ,可获取通知 **可选参数 :** @@ -2703,7 +2703,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` **调用例子 :** `/msg/notices?limit=3` ### 设置 -说明 : 登陆后调用此接口 ,可获取用户设置 +说明 : 登录后调用此接口 ,可获取用户设置 **接口地址 :** `/setting` @@ -2763,14 +2763,14 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 我的数字专辑 -说明 : 登陆后调用此接口 ,可获取我的数字专辑 +说明 : 登录后调用此接口 ,可获取我的数字专辑 **接口地址 :** `/digitalAlbum/purchased` **调用例子 :** `/digitalAlbum/purchased?limit=10` ### 购买数字专辑 -说明 : 登陆后调用此接口 ,可获取购买数字专辑的地址,把地址生成二维码后,可扫描购买专辑 +说明 : 登录后调用此接口 ,可获取购买数字专辑的地址,把地址生成二维码后,可扫描购买专辑 **必选参数 :** @@ -2785,7 +2785,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` **调用例子 :** `/digitalAlbum/ordering?id=86286082&payment=3&quantity=1` ### batch批量请求接口 -说明 : 登陆后调用此接口 ,传入接口和对应原始参数(原始参数非文档里写的参数,需参考源码),可批量请求接口 +说明 : 登录后调用此接口 ,传入接口和对应原始参数(原始参数非文档里写的参数,需参考源码),可批量请求接口 **接口地址 :** `/batch` diff --git a/docs/v2.md b/docs/v2.md index 8ba8727..d8382f3 100644 --- a/docs/v2.md +++ b/docs/v2.md @@ -176,7 +176,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api !> 为使用方便,降低门槛,登录接口直接使用了 get 明文请求,请按实际需求对源码修改 -!> 由于接口做了缓存处理 ( 缓存 2 分钟 , 可在 app.js 设置 , 可能会导致登陆后获取不 +!> 由于接口做了缓存处理 ( 缓存 2 分钟 , 可在 app.js 设置 , 可能会导致登录后获取不 到 cookie), 相同的 url 会在两分钟内只向网易服务器发一次请求 , 如果遇到不需要缓 存结果的接口 , 可在请求 url 后面加一个时间戳参数使 url 不同 , 例子 : `/simi/playlist?id=347230×tamp=1503019930000` @@ -184,7 +184,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api !> 如果是跨域请求 , 请在所有请求带上 `xhrFields: { withCredentials: true }` 否则 可能会因为没带上 cookie 导致 301, 具体例子可看 `public/test.html`, 例子使用 jQuery, axios 版本也类似 -!> 301 错误基本都是没登录就调用了需要登录的接口,如果登陆了还是提示 301, 基本都是缓存把数据缓存起来了,解决方法是等待 2 分钟或者重启服务重新登录后再调用接口 +!> 301 错误基本都是没登录就调用了需要登录的接口,如果登录了还是提示 301, 基本都是缓存把数据缓存起来了,解决方法是等待 2 分钟或者重启服务重新登录后再调用接口 !> 部分接口如登录接口不能调用太频繁 , 否则可能会触发 503 错误或者 ip 高频错误 ,若需频繁调用 , 需要准备 IP 代理池 (更新:已加入缓存机制,但仍需注意). @@ -250,7 +250,7 @@ Cookies ### 获取用户详情 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户详情 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户详情 **必选参数 :** `uid` : 用户 id @@ -260,7 +260,7 @@ Cookies ### 获取用户信息 , 歌单,收藏,mv, dj 数量 -说明 : 登陆后调用此接口 , 可以获取用户信息 +说明 : 登录后调用此接口 , 可以获取用户信息 **接口地址 :** `/user/subcount` @@ -268,7 +268,7 @@ Cookies ### 更新用户信息 -说明 : 登陆后调用此接口 , 传入相关信息,可以更新用户信息 +说明 : 登录后调用此接口 , 传入相关信息,可以更新用户信息 **必选参数 :** @@ -287,7 +287,7 @@ signature:用户签名 ### 获取用户歌单 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户歌单 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户歌单 **必选参数 :** `uid` : 用户 id @@ -300,7 +300,7 @@ signature:用户签名 ### 更新歌单 -说明 : 登陆后调用此接口,可以更新用户歌单 +说明 : 登录后调用此接口,可以更新用户歌单 参数: ``` @@ -316,7 +316,7 @@ tags:歌单tag ### 发送私信 -说明 : 登陆后调用此接口 , 传入用户 id 和要发送的信息, 可以发送私信,返回内容为历史私信,包含带歌单的私信信息(注:不能发送私信给自己) +说明 : 登录后调用此接口 , 传入用户 id 和要发送的信息, 可以发送私信,返回内容为历史私信,包含带歌单的私信信息(注:不能发送私信给自己) **必选参数 :** @@ -332,7 +332,7 @@ tags:歌单tag ### 发送私信(带歌单) -说明 : 登陆后调用此接口 , 传入用户 id 和要发送的信息和歌单 id, 可以发送带歌单的私信(注:不能发送重复的歌单) +说明 : 登录后调用此接口 , 传入用户 id 和要发送的信息和歌单 id, 可以发送带歌单的私信(注:不能发送重复的歌单) **必选参数 :** @@ -348,7 +348,7 @@ tags:歌单tag ### 获取用户电台 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户电台 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户电台 **必选参数 :** `uid` : 用户 id @@ -358,7 +358,7 @@ tags:歌单tag ### 获取用户关注列表 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户关注列表 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户关注列表 **必选参数 :** `uid` : 用户 id @@ -374,7 +374,7 @@ tags:歌单tag ### 获取用户粉丝列表 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户粉丝列表 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户粉丝列表 **必选参数 :** `uid` : 用户 id @@ -387,7 +387,7 @@ tags:歌单tag ### 获取用户动态 -说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户动态 +说明 : 登录后调用此接口 , 传入用户 id, 可以获取用户动态 **必选参数 :** `uid` : 用户 id @@ -397,7 +397,7 @@ tags:歌单tag ### 获取用户播放记录 -说明 : 登陆后调用此接口 , 传入用户 id, 可获取用户播放记录 +说明 : 登录后调用此接口 , 传入用户 id, 可获取用户播放记录 **必选参数 :** `uid` : 用户 id @@ -1323,7 +1323,7 @@ MV 数据 , 数据包含 mv 名字 , 歌手 , 发布时间 , mv 视频地址等 ### 云盘 -说明 : 登陆后调用此接口 , 可获取云盘数据 , 获取的数据没有对应 url, 需要再调用一 +说明 : 登录后调用此接口 , 可获取云盘数据 , 获取的数据没有对应 url, 需要再调用一 次 `/music/url` 获取 url **接口地址 :** `/user/cloud` @@ -1332,7 +1332,7 @@ MV 数据 , 数据包含 mv 名字 , 歌手 , 发布时间 , mv 视频地址等 ### 电台 - 推荐 -说明 : 登陆后调用此接口 , 可获得推荐电台 +说明 : 登录后调用此接口 , 可获得推荐电台 **接口地址 :** `/dj/recommend` @@ -1340,7 +1340,7 @@ MV 数据 , 数据包含 mv 名字 , 歌手 , 发布时间 , mv 视频地址等 ### 电台 - 分类 -说明 : 登陆后调用此接口 , 可获得电台类型 +说明 : 登录后调用此接口 , 可获得电台类型 **接口地址 :** `/dj/catelist` @@ -1348,7 +1348,7 @@ MV 数据 , 数据包含 mv 名字 , 歌手 , 发布时间 , mv 视频地址等 ### 电台 - 分类推荐 -说明 : 登陆后调用此接口 , 可获得推荐电台 +说明 : 登录后调用此接口 , 可获得推荐电台 **必选参数 :** `type`: 电台类型 , 数字 , 可通过`/dj/catelist`获取 , 对应关系为 id 对应 此接口的 type, name 对应类型意义 @@ -1359,7 +1359,7 @@ id 对应 此接口的 type, name 对应类型意义 ### 电台 - 订阅 -说明 : 登陆后调用此接口 , 传入`rid`, 可订阅 dj,dj 的 `rid` 可通过搜索指定 +说明 : 登录后调用此接口 , 传入`rid`, 可订阅 dj,dj 的 `rid` 可通过搜索指定 type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` **必选参数 :** `rid`: 电台 的 id @@ -1371,7 +1371,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台的订阅列表 -说明 : 登陆后调用此接口 , 可获取订阅的电台列表 +说明 : 登录后调用此接口 , 可获取订阅的电台列表 **接口地址 :** `/dj/sublist` @@ -1387,7 +1387,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 详情 -说明 : 登陆后调用此接口 , 传入`rid`, 可获得对应电台的详情介绍 +说明 : 登录后调用此接口 , 传入`rid`, 可获得对应电台的详情介绍 **必选参数 :** `rid`: 电台 的 id @@ -1397,7 +1397,7 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` ### 电台 - 节目 -说明 : 登陆后调用此接口 , 传入`rid`, 可查看对应电台的电台节目以及对应的 id, 需要 +说明 : 登录后调用此接口 , 传入`rid`, 可查看对应电台的电台节目以及对应的 id, 需要 注意的是这个接口返回的 mp3Url 已经无效 , 都为 null, 但是通过调用 `/music/url` 这 个接口 , 传入节目 id 仍然能获取到节目音频 , 如 `/music/url?id=478446370` 获取代 码时间的一个节目的音频