commit
56f49c220e
|
|
@ -172,6 +172,14 @@ s
|
|||
|
||||
参数: id,歌单 id,可在歌单页 URL 中找到
|
||||
|
||||
#### 歌手专辑
|
||||
|
||||
举例: https://rss.prprpr.me/ncm/artist/2116
|
||||
|
||||
路由: `/ncm/artist/:id`
|
||||
|
||||
参数: id,歌手 id,可在歌手详情页 URL 中找到
|
||||
|
||||
### 掘金
|
||||
|
||||
#### 分类
|
||||
|
|
@ -279,4 +287,4 @@ number: 快递单号
|
|||
|
||||
- Redis
|
||||
|
||||
- Node.js
|
||||
- Node.js
|
||||
|
|
|
|||
2
index.js
2
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/artist/:id', require('./routes/ncm/artist'));
|
||||
|
||||
// 掘金
|
||||
app.get('/juejin/category/:category', require('./routes/juejin/category'));
|
||||
|
|
@ -37,7 +38,6 @@ app.get('/jianshu/trending/monthly', require('./routes/jianshu/monthly'));
|
|||
app.get('/jianshu/collection/:id', require('./routes/jianshu/collection'));
|
||||
app.get('/jianshu/user/:id', require('./routes/jianshu/user'));
|
||||
|
||||
|
||||
// 知乎
|
||||
app.get('/zhihu/collection/:id', require('./routes/zhihu/collection'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
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 id = req.params.id;
|
||||
|
||||
base({
|
||||
req: req,
|
||||
res: res,
|
||||
getHTML: (callback) => {
|
||||
request.get({
|
||||
url: 'https://music.163.com/api/artist/albums/' + id,
|
||||
headers: {
|
||||
'User-Agent': mix.ua,
|
||||
'Referer': 'https://music.163.com/'
|
||||
}
|
||||
}, (err, httpResponse, body) => {
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(body);
|
||||
}
|
||||
catch (e) {
|
||||
data = {};
|
||||
}
|
||||
const result = data;
|
||||
|
||||
const html = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
title: result.artist.name,
|
||||
link: `https://music.163.com/#/artist/album?id=${id}`,
|
||||
description: `网易云音乐歌手专辑 - ${result.artist.name}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: result.hotAlbums && result.hotAlbums.map((item) => {
|
||||
const singer = item.artists.length === 1 ? item.artists[0].name : item.artists.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name);
|
||||
return {
|
||||
title: `${item.name} - ${singer}`,
|
||||
description: `歌手:${singer}<br>专辑:${item.name}<br>日期:${new Date(item.publishTime).toLocaleDateString()}<br><img referrerpolicy="no-referrer" src="${item.picUrl}">`,
|
||||
link: `https://music.163.com/#/album?id=${item.id}`
|
||||
};
|
||||
}),
|
||||
});
|
||||
callback(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
Loading…
Reference in New Issue