From 44bb25e81cbbea214207b0dd7d457240ca78f47c Mon Sep 17 00:00:00 2001 From: binaryify Date: Sat, 27 Feb 2021 19:58:24 +0800 Subject: [PATCH] v4.0.7,#1151 #1152 #1143 #1161 --- CHANGELOG.MD | 13 +++++++++++++ README.MD | 1 + docs/README.md | 23 ++++++++++++++--------- interface.d.ts | 30 +++++++++++++++++++++--------- module/captcha_sent.js | 2 +- module/register_cellphone.js | 1 + module/song_detail.js | 3 +-- module/user_bindingcellphone.js | 21 +++++++++++++++++++++ module/user_followeds.js | 4 +++- 9 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 module/user_bindingcellphone.js diff --git a/CHANGELOG.MD b/CHANGELOG.MD index e20246b..6527be0 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,17 @@ # 更新日志 +### 4.0.7 | 2021.2.27 +- 更新红心接口,修复红心接口460错误问题 [#1151](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1151) + +- 更新发送验证码接口 + +- 注册接口添加 countrycode 参数 [#1152](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1152) + +- 新增绑定手机接口 [#1152](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1152) + +- 更新 song/detail 接口 [#1143](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1143) + +- 用户粉丝接口修改分页参数 [#1161](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1161) + ### 4.0.6 | 2021.2.20 - 修复 eapi 接口无法正确解密response的问题 [#1138](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1138) diff --git a/README.MD b/README.MD index 0ccf8b4..4d5b975 100644 --- a/README.MD +++ b/README.MD @@ -304,6 +304,7 @@ banner({ type:0 }).then(res=>{ 200. 话题详情 201. 话题详情热门动态 202. 歌单详情动态 +203. 绑定手机 ## 更新日志 diff --git a/docs/README.md b/docs/README.md index cabe9c6..fc175c6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -218,6 +218,7 @@ 200. 话题详情 201. 话题详情热门动态 202. 歌单详情动态 +203. 绑定手机 ## 安装 @@ -478,8 +479,6 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 **调用例子 :** `/captcha/sent?phone=13xxx` - - ### 验证验证码 说明 : 调用此接口 ,传入手机号码和验证码, 可校验验证码是否正确 @@ -511,16 +510,22 @@ v3.30.0后支持手动传入cookie,登录接口返回内容新增 `cookie` 字 `nickname`: 昵称 +**可选参数 :** + +`countrycode`: 国家码,用于国外手机号,例如美国传入:`1` ,默认86即中国 + **接口地址 :** `/register/cellphone` **调用例子 :** `/register/cellphone?phone=13xxx&password=xxxxx&captcha=1234&nickname=binary1345` ### 检测手机号码是否已注册 说明 : 调用此接口 ,可检测手机号码是否已注册 -**必选参数 :** +**必选参数 :** `phone` : 手机号码 -**可选参数 :** -`countrycode`: 国家码,用于国外手机号,例如美国传入:`1` + +**可选参数 :** +`countrycode`: 国家码,用于国外手机号,例如美国传入:`1` ,默认86即中国 + **接口地址 :** `/cellphone/existence/check` **调用例子 :** `/cellphone/existence/check?phone=13xxx` @@ -834,14 +839,14 @@ tags: 歌单标签 **必选参数 :** `uid` : 用户 id -**可选参数 :** `limit` : 返回数量 , 默认为 30 - -`lasttime` : 返回数据的 `lasttime` ,默认-1,传入上一次返回结果的 lasttime,将会返回下一页的数据 +**可选参数 :** +`limit` : 返回数量 , 默认为 30 +`offset` : 偏移数量,用于分页 ,如 :( 页数 -1)\*30, 其中 30 为 limit 的值 , 默认为 0 **接口地址 :** `/user/followeds` -**调用例子 :** `/user/followeds?uid=32953014` `/user/followeds?uid=416608258&time=1560152549136` +**调用例子 :** `/user/followeds?uid=32953014` `/user/followeds?uid=416608258&limit=1` `/user/followeds?uid=416608258&limit=1&offset=1` ### 获取用户动态 diff --git a/interface.d.ts b/interface.d.ts index dea6c66..4a7687b 100644 --- a/interface.d.ts +++ b/interface.d.ts @@ -264,19 +264,22 @@ export function batch( ): Promise export function captcha_sent( - params: { cellphone: string; ctcode?: string } & RequestBaseConfig, + params: { cellphone: string; ctcode?: number | string } & RequestBaseConfig, ): Promise export function captcha_verify( params: { - ctcode?: string - cellphone: string + ctcode?: number | string + cellphone: number | string captcha: string } & RequestBaseConfig, ): Promise export function cellphone_existence_check( - params: { cellphone: string; countrycode: string } & RequestBaseConfig, + params: { + cellphone: number | string + countrycode: number | string + } & RequestBaseConfig, ): Promise export function check_music( @@ -674,16 +677,16 @@ export function login( export function login_cellphone( params: { - phone: string - countrycode?: string + phone: number | string + countrycode?: number | string password: string } & RequestBaseConfig, ): Promise export function login_cellphone( params: { - phone: string - countrycode?: string + phone: number | string + countrycode?: number | string md5_password: string } & RequestBaseConfig, ): Promise @@ -903,7 +906,7 @@ export function rebind( captcha: string phone: string oldcaptcha: string - ctcode?: string + ctcode?: number | string } & RequestBaseConfig, ): Promise @@ -1393,3 +1396,12 @@ export function login_qr_check( export function playlist_detail_dynamic( params: { id: string | number } & RequestBaseConfig, ): Promise + +export function user_bindingcellphone( + params: { + phone: number | string + captcha: number | string + countrycode?: number | string + password?: string + } & RequestBaseConfig, +): Promise diff --git a/module/captcha_sent.js b/module/captcha_sent.js index ef7b3af..076dcbb 100644 --- a/module/captcha_sent.js +++ b/module/captcha_sent.js @@ -5,7 +5,7 @@ module.exports = (query, request) => { ctcode: query.ctcode || '86', cellphone: query.phone, } - return request('POST', `https://music.163.com/weapi/sms/captcha/sent`, data, { + return request('POST', `https://music.163.com/api/sms/captcha/sent`, data, { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy, diff --git a/module/register_cellphone.js b/module/register_cellphone.js index 602e0fa..d03c51a 100644 --- a/module/register_cellphone.js +++ b/module/register_cellphone.js @@ -8,6 +8,7 @@ module.exports = (query, request) => { phone: query.phone, password: crypto.createHash('md5').update(query.password).digest('hex'), nickname: query.nickname, + countrycode: query.countrycode || '86', } return request('POST', `https://music.163.com/api/register/cellphone`, data, { crypto: 'weapi', diff --git a/module/song_detail.js b/module/song_detail.js index 0a7d506..ffbb17f 100644 --- a/module/song_detail.js +++ b/module/song_detail.js @@ -3,8 +3,7 @@ module.exports = (query, request) => { query.ids = query.ids.split(/\s*,\s*/) const data = { - c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']', - ids: '[' + query.ids.join(',') + ']', + c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']' } return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, { crypto: 'weapi', diff --git a/module/user_bindingcellphone.js b/module/user_bindingcellphone.js new file mode 100644 index 0000000..abe1c98 --- /dev/null +++ b/module/user_bindingcellphone.js @@ -0,0 +1,21 @@ +module.exports = (query, request) => { + const data = { + phone: query.phone, + countrycode: query.countrycode || '86', + captcha: query.captcha, + password: query.password + ? crypto.createHash('md5').update(query.password).digest('hex') + : '', + } + return request( + 'POST', + `https://music.163.com/api/user/bindingCellphone`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/user_followeds.js b/module/user_followeds.js index a071ed2..678477a 100644 --- a/module/user_followeds.js +++ b/module/user_followeds.js @@ -3,8 +3,10 @@ module.exports = (query, request) => { const data = { userId: query.uid, - time: query.lasttime || -1, + time: '0', limit: query.limit || 30, + offset: query.offset || 0, + getcounts: 'true', } return request( 'POST', -- GitLab