Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Vanishing597
NeteaseCloudMusicApi
提交
49d82d79
N
NeteaseCloudMusicApi
项目概览
Vanishing597
/
NeteaseCloudMusicApi
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NeteaseCloudMusicApi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49d82d79
编写于
7月 30, 2018
作者:
B
binaryify
提交者:
GitHub
7月 30, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #286 from nondanee/bandage
相关歌单推荐自制接口
上级
f80c5887
af07374b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
2 deletion
+42
-2
router/artist_list.js
router/artist_list.js
+4
-1
router/related_playlist.js
router/related_playlist.js
+37
-0
util/util.js
util/util.js
+1
-1
未找到文件。
router/artist_list.js
浏览文件 @
49d82d79
...
...
@@ -22,11 +22,14 @@ module.exports = (req, res, createWebAPIRequest, request) => {
// 其他女歌手 4002
// 其他组合/乐队 4003
// initial 取值a-z/A-Z
const
data
=
{
categoryCode
:
req
.
query
.
cat
||
"
1001
"
,
offset
:
req
.
query
.
offset
||
0
,
total
:
req
.
query
.
total
?
"
true
"
:
"
false
"
,
limit
:
req
.
query
.
limit
||
30
limit
:
req
.
query
.
limit
||
30
,
initial
:
(
req
.
query
.
initial
||
""
).
toUpperCase
().
charCodeAt
()
||
""
};
createWebAPIRequest
(
"
music.163.com
"
,
...
...
router/related_playlist.js
0 → 100644
浏览文件 @
49d82d79
//related ,相关歌单
module
.
exports
=
(
req
,
res
,
createWebAPIRequest
,
request
)
=>
{
const
options
=
{
url
:
"
http://music.163.com/playlist?id=
"
+
req
.
query
.
id
,
method
:
"
GET
"
,
headers
:
{
Referer
:
"
http://music.163.com
"
,
"
User-Agent
"
:
"
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3380.0 Safari/537.36
"
}
};
request
(
options
,
(
error
,
response
,
body
)
=>
{
if
(
error
)
{
res
.
status
(
502
).
send
(
"
fetch error
"
);
}
else
{
try
{
const
pattern
=
/<div class="cver u-cover u-cover-3">
[\s\S]
*
?
<img src="
([^
"
]
+
)
">
[\s\S]
*
?
<a class="sname f-fs1 s-fc0" href="
([^
"
]
+
)
"
[^
>
]
*>
([^
<
]
+
?)
<
\/
a>
[\s\S]
*
?
<a class="nm nm f-thide s-fc3" href="
([^
"
]
+
)
"
[^
>
]
*>
([^
<
]
+
?)
<
\/
a>/g
;
const
data
=
{
playlists
:[],
code
:
200
};
let
result
;
while
((
result
=
pattern
.
exec
(
body
))
!=
null
)
{
data
.
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
)
});
}
res
.
send
(
JSON
.
stringify
(
data
));
}
catch
(
error
)
{
res
.
status
(
502
).
send
(
"
fetch error
"
);
}
}
});
};
util/util.js
浏览文件 @
49d82d79
...
...
@@ -40,7 +40,7 @@ function createWebAPIRequest(
errorcallback
)
{
// console.log(cookie);
if
(
cookie
.
match
(
/_csrf=
[^
(;|$)
]
+
;
/g
))
if
(
cookie
.
match
(
/_csrf=
[^
(;|$)
]
+/g
))
data
.
csrf_token
=
cookie
.
match
(
/_csrf=
[^
(;|$)
]
+/g
)[
0
].
slice
(
6
);
else
data
.
csrf_token
=
""
;
const
proxy
=
cookie
.
split
(
"
__proxy__
"
)[
1
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录