提交 494a33c3 编写于 作者: B binaryify

#816, #817, #818

上级 20cba0aa
# 更新日志
### 3.33.0 | 2020.06.10
- 歌手榜支持地区参数 [#818](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/818)
- 新增视频分类列表,推荐视频,获取全部视频列表接口 [#816](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/816)
- 内置 apicache,修复不能在 NodeJS v13 版本使用的问题 [#817](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/817)
### 3.32.3 | 2020.06.07
- 修复 Nodejs 下 cookie 使用格式问题 [#812](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/812)
......
......@@ -19,8 +19,6 @@
[sqaiyan/netmusic-node](https://github.com/sqaiyan/netmusic-node)
## 功能特性
1. 登录
2. 刷新登录
3. 发送验证码
......@@ -115,7 +113,7 @@
92. 收藏的 MV 列表
93. 获取最新专辑
94. 听歌打卡
95. 获取视频标签下的视频
95. 获取视频标签/分类下的视频
96. 已收藏专辑列表
97. 获取动态评论
98. 歌单收藏者列表
......@@ -171,6 +169,9 @@
148. 调整歌单顺序
149. 调整歌曲顺序
150. 独家放送列表
151. 获取推荐视频
152. 获取视频分类列表
153. 获取全部视频列表接口
## 环境要求
......
......@@ -5,7 +5,7 @@ const bodyParser = require('body-parser')
const request = require('./util/request')
const packageJSON = require('./package.json')
const exec = require('child_process').exec
const cache = require('apicache').middleware
const cache = require('./util/apicache').middleware
// version check
exec('npm info NeteaseCloudMusicApi version', (err, stdout, stderr) => {
......
......@@ -110,7 +110,7 @@
92. 收藏的 MV 列表
93. 获取最新专辑
94. 听歌打卡
95. 获取视频标签下的视频
95. 获取视频标签/分类下的视频
96. 已收藏专辑列表
97. 获取动态评论
98. 歌单收藏者列表
......@@ -166,6 +166,9 @@
148. 调整歌单顺序
149. 调整歌曲顺序
150. 独家放送列表
151. 获取推荐视频
152. 获取视频分类列表
153. 获取全部视频列表接口
## 安装
......@@ -1967,15 +1970,44 @@ MV 点赞转发评论数数据
**调用例子 :** `/video/group/list`
### 获取视频标签下的视频
说明 : 调用此接口 , 传入`id`,可获取到相关的视频。 (ps:无法分页,每次请求返回内容都不一样,官方桌面软件是打开先请求两次,然后每次滚动到底部的时候再请求一次)
### 获取视频分类列表
说明 : 调用此接口 , 可获取视频分类列表
**必选参数 :** `id`: videoGroup 的 id
**接口地址 :** `/video/category/list`
**调用例子 :** `/video/category/list`
### 获取视频标签/分类下的视频
说明 : 调用此接口 , 传入标签/分类`id`,可获取到相关的视频,分页参数只能传入offset
**必选参数 :** `id`: videoGroup 的 id
**可选参数 :** `offset`: 默认0
**接口地址 :** `/video/group`
**调用例子 :** `/video/group?id=9104`
### 获取全部视频列表
说明 : 调用此接口,可获取视频分类列表,分页参数只能传入offset
**可选参数 :** `offset`: 默认0
**接口地址 :** `/video/timeline/all`
**调用例子 :** `/video/timeline/all`
### 获取推荐视频
说明 : 调用此接口, 可获取推荐视频,分页参数只能传入offset
**必选参数 :** `id`: videoGroup 的 id
**可选参数 :** `offset`: 默认0
**接口地址 :** `/video/group`
**调用例子 :** `/video/timeline/recommend`
### 相关视频
说明 : 调用此接口 , 可获取相关视频
......@@ -2120,6 +2152,14 @@ MV 点赞转发评论数数据
说明 : 调用此接口 , 可获取排行榜中的歌手榜
**可选参数 :**
```
type : 地区
1: 华语
2: 欧美
3: 韩国
4: 日本
```
**接口地址 :** `/toplist/artist`
**调用例子 :** `/toplist/artist`
......
......@@ -7,7 +7,6 @@ module.exports = (query, request) => {
offset: query.offset || 0,
asc: toBoolean(query.asc)
}
console.log(toBoolean(query.asc))
return request(
'POST',
`https://music.163.com/weapi/dj/program/byradio`,
......
......@@ -7,7 +7,6 @@ module.exports = (query, request) => {
op: 'update',
}
console.log(data)
return request(
'POST', `http://interface.music.163.com/api/playlist/manipulate/tracks`, data,
{
......
......@@ -2,7 +2,7 @@
module.exports = (query, request) => {
const data = {
type: 1,
type: query.type || 1,
limit: 100,
offset: 0,
total: true
......
module.exports = (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
}
);
};
\ No newline at end of file
// 视频链接
module.exports = (query, request) => {
const data = {
groupId: query.id,
offset: query.offset || 0,
needUrl: true,
resolution: query.res || 1080
need_preview_url: 'true',
total: true
}
return request(
'POST', `https://music.163.com/weapi/videotimeline/videogroup/get`, data, {
'POST', `https://music.163.com/api/videotimeline/videogroup/otherclient/get`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy
......
module.exports = (query, request) => {
const data = {
groupId: 0,
offset: query.offset || 0,
need_preview_url: 'true',
total: true
}
console.log({data})
// /api/videotimeline/otherclient/get
return request(
'POST', `https://music.163.com/api/videotimeline/otherclient/get`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy
}
)
}
module.exports = (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
}
);
};
\ No newline at end of file
{
"name": "NeteaseCloudMusicApi",
"version": "3.32.3",
"version": "3.33.0",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
......@@ -35,7 +35,6 @@
"util"
],
"dependencies": {
"apicache": "^1.5.2",
"express": "^4.17.1",
"pac-proxy-agent": "^3.0.1",
"request": "^2.88.0"
......@@ -49,4 +48,4 @@
"mocha": "^6.2.2",
"power-assert": "^1.6.1"
}
}
\ No newline at end of file
}
此差异已折叠。
function MemoryCache() {
this.cache = {}
this.size = 0
}
MemoryCache.prototype.add = function(key, value, time, timeoutCallback) {
var old = this.cache[key]
var instance = this
var entry = {
value: value,
expire: time + Date.now(),
timeout: setTimeout(function() {
instance.delete(key)
return timeoutCallback && typeof timeoutCallback === 'function' && timeoutCallback(value, key)
}, time)
}
this.cache[key] = entry
this.size = Object.keys(this.cache).length
return entry
}
MemoryCache.prototype.delete = function(key) {
var entry = this.cache[key]
if (entry) {
clearTimeout(entry.timeout)
}
delete this.cache[key]
this.size = Object.keys(this.cache).length
return null
}
MemoryCache.prototype.get = function(key) {
var entry = this.cache[key]
return entry
}
MemoryCache.prototype.getValue = function(key) {
var entry = this.get(key)
return entry && entry.value
}
MemoryCache.prototype.clear = function() {
Object.keys(this.cache).forEach(function(key) {
this.delete(key)
}, this)
return true
}
module.exports = MemoryCache
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册