mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 06:30:40 +08:00
feat: add jian-ning blog (#5600)
Co-authored-by: Chang Lan <clan@eecs.berkeley.edu>
This commit is contained in:
@@ -2262,7 +2262,7 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'wenxuecity.com/': {
|
'wenxuecity.com': {
|
||||||
_name: '文学城',
|
_name: '文学城',
|
||||||
blog: [
|
blog: [
|
||||||
{
|
{
|
||||||
@@ -2276,6 +2276,9 @@
|
|||||||
docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-bo-ke',
|
docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-bo-ke',
|
||||||
source: '/myoverview/:id',
|
source: '/myoverview/:id',
|
||||||
target: 'wenxuecity/blog/:id',
|
target: 'wenxuecity/blog/:id',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
'buaq.net': {
|
'buaq.net': {
|
||||||
_name: '不安全资讯',
|
_name: '不安全资讯',
|
||||||
'.': [
|
'.': [
|
||||||
@@ -2287,4 +2290,15 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
'jian-ning.com': {
|
||||||
|
_name: '建宁闲谈',
|
||||||
|
'.': [
|
||||||
|
{
|
||||||
|
title: '文章',
|
||||||
|
docs: 'https://docs.rsshub.app/blog.html#jian-ning-xian-tan',
|
||||||
|
source: '/*',
|
||||||
|
target: '/blogs/jianning',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="kt286" example="/daxiaamu/home" path="/daxiaamu/home"/>
|
<Route author="kt286" example="/daxiaamu/home" path="/daxiaamu/home"/>
|
||||||
|
|
||||||
|
## 建宁闲谈
|
||||||
|
|
||||||
|
### 文章
|
||||||
|
|
||||||
|
<Route author="changlan" example="/blogs/jianning" path="/blogs/jianning" radar="1"/>
|
||||||
|
|
||||||
## 敬维博客
|
## 敬维博客
|
||||||
|
|
||||||
### 文章
|
### 文章
|
||||||
|
|||||||
@@ -151,12 +151,6 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5
|
|||||||
|
|
||||||
<Route author="nczitzk" example="/kongfz/people/5032170" path="/kongfz/people/:id" :paramsDesc="['用户 id, 可在对应用户页 URL 中找到']"/>
|
<Route author="nczitzk" example="/kongfz/people/5032170" path="/kongfz/people/:id" :paramsDesc="['用户 id, 可在对应用户页 URL 中找到']"/>
|
||||||
|
|
||||||
## 孔夫子旧书网
|
|
||||||
|
|
||||||
### 用户动态
|
|
||||||
|
|
||||||
<Route author="nczitzk" example="/kongfz/people/5032170" path="/kongfz/people/:id" :paramsDesc="['用户 id, 可在对应用户页 URL 中找到']"/>
|
|
||||||
|
|
||||||
### 店铺上架
|
### 店铺上架
|
||||||
|
|
||||||
<Route author="nczitzk" example="/kongfz/shop/238901/1" path="/kongfz/shop/:id/:cat?" :paramsDesc="['店铺 id, 可在对应店铺页 URL 中找到', '分类 id,可在对应分类页 URL 中找到,默认为店铺最新上架']"/>
|
<Route author="nczitzk" example="/kongfz/shop/238901/1" path="/kongfz/shop/:id/:cat?" :paramsDesc="['店铺 id, 可在对应店铺页 URL 中找到', '分类 id,可在对应分类页 URL 中找到,默认为店铺最新上架']"/>
|
||||||
|
|||||||
@@ -3185,4 +3185,7 @@ router.get('/secshi', require('./routes/secshi/index'));
|
|||||||
// 出海笔记
|
// 出海笔记
|
||||||
router.get('/chuhaibiji', require('./routes/chuhaibiji/index'));
|
router.get('/chuhaibiji', require('./routes/chuhaibiji/index'));
|
||||||
|
|
||||||
|
// 建宁闲谈
|
||||||
|
router.get('/blogs/jianning', require('./routes/blogs/jianning'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
45
lib/routes/blogs/jianning.js
Normal file
45
lib/routes/blogs/jianning.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const base_url = `http://jian-ning.com/all-articles.html`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: base_url,
|
||||||
|
responseType: 'buffer',
|
||||||
|
});
|
||||||
|
const data = iconv.decode(response.data, 'gbk');
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('li');
|
||||||
|
const out = list
|
||||||
|
.map(async (i, item) => {
|
||||||
|
const link = url.resolve('http://jian-ning.com', $(item).find('a').attr('href'));
|
||||||
|
const description = await ctx.cache.tryGet(link, async () => {
|
||||||
|
const result = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
responseType: 'buffer',
|
||||||
|
headers: {
|
||||||
|
Referer: base_url,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const content = cheerio.load(iconv.decode(result.data, 'gbk'));
|
||||||
|
return content('td td').html();
|
||||||
|
});
|
||||||
|
const post = {
|
||||||
|
title: $(item).find('a').text(),
|
||||||
|
link: link,
|
||||||
|
pubDate: $(item).find('span').text(),
|
||||||
|
description: description,
|
||||||
|
};
|
||||||
|
return post;
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('head > title').text(),
|
||||||
|
link: base_url,
|
||||||
|
item: await Promise.all(out),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user