mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
@@ -216,6 +216,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 焦点专题
|
||||
- Greasy Fork
|
||||
- 脚本更新
|
||||
- LinkedKeeper
|
||||
- 博文
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -1740,3 +1740,17 @@ id,用户 id,可在用户主页 URL 中找到
|
||||
language,语言,可在网站右上角找到, `all` 为所有语言
|
||||
|
||||
domain,按脚本生效域名过滤,可选
|
||||
|
||||
## LinkedKeeper
|
||||
|
||||
### 博文
|
||||
|
||||
举例: [https://rsshub.app/linkedkeeper/sub/1](https://rsshub.app/linkedkeeper/sub/1)
|
||||
|
||||
路由: `/linkedkeeper/:type/:id?`
|
||||
|
||||
参数:
|
||||
|
||||
type,博文分类,为 URL 中 `.action` 的文件名
|
||||
|
||||
id,可选,分区或标签的 ID,对应 URL 中的 `sid` 或 `tid`
|
||||
|
||||
@@ -393,4 +393,7 @@ router.get('/xueqiu/favorite/:id', require('./routes/xueqiu/favorite'));
|
||||
// Greasy Fork
|
||||
router.get('/greasyfork/:language/:domain?', require('./routes/greasyfork/scripts'));
|
||||
|
||||
// LinkedKeeper
|
||||
router.get('/linkedkeeper/:type/:id?', require('./routes/linkedkeeper/index'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
62
routes/linkedkeeper/index.js
Normal file
62
routes/linkedkeeper/index.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const id = ctx.params.id;
|
||||
|
||||
const res = await axios({
|
||||
method: 'get',
|
||||
url: `http://www.linkedkeeper.com/list/${type}.action`,
|
||||
params: {
|
||||
sid: id,
|
||||
tid: id,
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
},
|
||||
});
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('tbody').find('td');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('.blog_en_title')
|
||||
.text()
|
||||
.trim() ||
|
||||
$('.active')
|
||||
.text()
|
||||
.trim()} - LinkedKeeper`,
|
||||
link: res.request.res.responseUrl,
|
||||
item: list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const pubDate = new Date(
|
||||
item
|
||||
.find('dd:nth-child(3)')
|
||||
.text()
|
||||
.trim()
|
||||
.replace('月', '-')
|
||||
.replace('日', '')
|
||||
);
|
||||
pubDate.setFullYear(new Date().getFullYear());
|
||||
return {
|
||||
title: item
|
||||
.find('a.blog_weight')
|
||||
.text()
|
||||
.trim(),
|
||||
description: `${item
|
||||
.find('a.blog_weight')
|
||||
.text()
|
||||
.trim()} - ${item
|
||||
.find('.blog_author_13')
|
||||
.text()
|
||||
.trim()}`,
|
||||
pubDate: pubDate.toUTCString(),
|
||||
link: `http://www.linkedkeeper.com${item.find('a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user