@@ -263,6 +263,14 @@ s
|
||||
|
||||
参数: id,用户 id,可在用户主页 URL 中找到
|
||||
|
||||
#### 专栏
|
||||
|
||||
举例: https://rss.now.sh/zhihu/zhuanlan/googledevelopers
|
||||
|
||||
路由: `/zhihu/zhuanlan/:id`
|
||||
|
||||
参数: id,专栏 id,可在专栏主页 URL 中找到
|
||||
|
||||
### 自如
|
||||
|
||||
#### 房源
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
"koa-router": "7.4.0",
|
||||
"lru-cache": "4.1.2",
|
||||
"path-to-regexp": "2.2.0",
|
||||
"phantom": "^4.0.12",
|
||||
"readall": "1.0.0",
|
||||
"winston": "3.0.0-rc3"
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ router.get('/jianshu/user/:id', require('./routes/jianshu/user'));
|
||||
// // 知乎
|
||||
router.get('/zhihu/collection/:id', require('./routes/zhihu/collection'));
|
||||
router.get('/zhihu/people/activities/:id', require('./routes/zhihu/activities'));
|
||||
router.get('/zhihu/zhuanlan/:id', require('./routes/zhihu/zhuanlan'));
|
||||
|
||||
// // 贴吧
|
||||
router.get('/tieba/forum/:kw', require('./routes/tieba/forum'));
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const listRes = await axios({
|
||||
method: 'get',
|
||||
url: `https://zhuanlan.zhihu.com/api/columns/${id}/posts?limit=20`,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': `https://zhuanlan.zhihu.com/${id}`,
|
||||
}
|
||||
});
|
||||
const infoRes = await axios({
|
||||
method: 'get',
|
||||
url: `https://zhuanlan.zhihu.com/api/columns/${id}`,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': `https://zhuanlan.zhihu.com/${id}`,
|
||||
}
|
||||
});
|
||||
|
||||
const list = listRes.data;
|
||||
const info = infoRes.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
title: `知乎专栏-${info.name}`,
|
||||
link: `https://zhuanlan.zhihu.com/${id}`,
|
||||
description: info.description,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list.map((item) => {
|
||||
return {
|
||||
title: item.title,
|
||||
description: item.content,
|
||||
pubDate: new Date(item.publishedTime).toUTCString(),
|
||||
link: `https://zhuanlan.zhihu.com${item.url}`
|
||||
};
|
||||
}),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user