feat(route): add 赵容部落 (#14580)

This commit is contained in:
cnkmmk
2024-02-29 00:08:40 +08:00
committed by GitHub
parent 7e3c1a2b67
commit f02487a97c
5 changed files with 59 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/': ['cnkmmk'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'zrblog.net': {
_name: '赵容部落',
'.': [
{
title: '博客',
docs: 'https://docs.rsshub.app/routes/blog#zhao-rong-bu-luo',
source: ['/'],
target: '/zrblog',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./rss'));
};
+34
View File
@@ -0,0 +1,34 @@
const { parseDate } = require('@/utils/parse-date');
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'https://www.zrblog.net/';
const response = await got({ method: 'get', url });
const $ = cheerio.load(response.data);
const list = $("div.art_img_box")
.map((i, e) => {
const element = $(e);
const title = element.find('h2 > a').attr('title');
const link = element.find('h2 > a').attr('href');
const description = element.find('p.intro').text();
const dateraw = element.find("div.info").find('span').eq(0).text();
return {
title,
description,
link,
pubDate: parseDate(dateraw, '发布日期:YYYY年MM月DD日'),
};
})
.get();
ctx.state.data = {
title: '赵容部落',
link: url,
item: list,
};
};
+6
View File
@@ -485,3 +485,9 @@
### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20}
<Route author="nczitzk" example="/zhubai/top20" path="/zhubai/top20" radar="1" />
## 赵容部落 {#zhao-rong-bu-luo}
### 博客 {#zhao-rong-bu-luo-bo-ke}
<Route author="cnkmmk" example="/zrblog" path="/zrblog" />