mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
@@ -20,6 +20,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 博主
|
||||
- 网易云音乐
|
||||
- 歌单
|
||||
- 用户全部歌单
|
||||
- 掘金
|
||||
- 分类
|
||||
- 简书
|
||||
|
||||
@@ -164,7 +164,7 @@ s
|
||||
|
||||
### 网易云音乐
|
||||
|
||||
#### 歌单
|
||||
#### 歌单歌曲
|
||||
|
||||
举例: https://rss.prprpr.me/ncm/playlist/35798529
|
||||
|
||||
@@ -172,6 +172,14 @@ s
|
||||
|
||||
参数: id,歌单 id,可在歌单页 URL 中找到
|
||||
|
||||
#### 用户歌单
|
||||
|
||||
举例: https://rss.prprpr.me/ncm/user/playlist/45441555
|
||||
|
||||
路由: `/ncm/user/playlist/:uid`
|
||||
|
||||
参数: uid,用户 uid,可在用户主页 URL 中找到
|
||||
|
||||
#### 歌手专辑
|
||||
|
||||
举例: https://rss.prprpr.me/ncm/artist/2116
|
||||
|
||||
1
index.js
1
index.js
@@ -20,6 +20,7 @@ app.get('/weibo/user/:uid', require('./routes/weibo/user'));
|
||||
|
||||
// 网易云音乐
|
||||
app.get('/ncm/playlist/:id', require('./routes/ncm/playlist'));
|
||||
app.get('/ncm/user/playlist/:uid', require('./routes/ncm/userplaylist'));
|
||||
app.get('/ncm/artist/:id', require('./routes/ncm/artist'));
|
||||
|
||||
// 掘金
|
||||
|
||||
66
routes/ncm/userplaylist.js
Normal file
66
routes/ncm/userplaylist.js
Normal file
@@ -0,0 +1,66 @@
|
||||
const request = require('request');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const base = require('../base');
|
||||
const mix = require('../../utils/mix');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
const uid = req.params.uid;
|
||||
|
||||
base({
|
||||
req: req,
|
||||
res: res,
|
||||
getHTML: (callback) => {
|
||||
request.post(
|
||||
{
|
||||
url: 'http://music.163.com/api/user/playlist',
|
||||
headers: {
|
||||
'User-Agent': mix.ua,
|
||||
Referer: 'https://music.163.com/'
|
||||
},
|
||||
form: {
|
||||
uid: uid,
|
||||
limit: 1000,
|
||||
offset: 0
|
||||
}
|
||||
},
|
||||
(err, httpResponse, body) => {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(body);
|
||||
} catch (e) {
|
||||
data = {};
|
||||
}
|
||||
const playlist = data.playlist || [{ creator: {} }];
|
||||
|
||||
const creator = playlist[0].creator;
|
||||
|
||||
const { nickname, signature } = creator;
|
||||
|
||||
const html = art(
|
||||
path.resolve(__dirname, '../../views/rss.art'),
|
||||
{
|
||||
title: `${nickname} 的所有歌单`,
|
||||
link: `http://music.163.com/user/home?id=${uid}`,
|
||||
description: signature,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item:
|
||||
playlist[0].id &&
|
||||
playlist.map((pl) => ({
|
||||
title: pl.name,
|
||||
description: pl.description,
|
||||
pubDate: new Date(
|
||||
pl.createTime
|
||||
).toUTCString(),
|
||||
link: `http://music.163.com/playlist?id=${
|
||||
pl.id
|
||||
}`
|
||||
}))
|
||||
}
|
||||
);
|
||||
callback(html);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user