feat(route): add 国外主机测评 (#14633)

This commit is contained in:
cnkmmk
2024-03-03 23:09:47 +08:00
committed by GitHub
parent 172f6cfd2b
commit 7a93e0c727
5 changed files with 57 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/': ['cnkmmk'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'zhujiceping.com': {
_name: '国外主机测评',
'.': [
{
title: '最新发布',
docs: 'https://docs.rsshub.app/routes/blog#guo-wai-zhu-ji-ce-ping',
source: ['/'],
target: '/zhujiceping',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
export default (router) => {
router.get('/', './rss');
};
+32
View File
@@ -0,0 +1,32 @@
import { parseDate } from '@/utils/parse-date';
import got from '@/utils/got';
import { load } from 'cheerio';
export default async (ctx) => {
const url = 'https://www.zhujiceping.com/';
const response = await got({ method: 'get', url });
const $ = load(response.data);
const list = $('article.excerpt')
.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.note').text();
const dateraw = element.find('time').text();
return {
title,
description,
link,
pubDate: parseDate(dateraw, 'YYYY-MM-DD'),
};
})
.get();
ctx.set('data', {
title: '国外主机测评',
link: url,
item: list,
});
};
+6
View File
@@ -491,3 +491,9 @@
### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20}
<Route author="nczitzk" example="/zhubai/top20" path="/zhubai/top20" radar="1" />
## 国外主机测评 {#guo-wai-zhu-ji-ce-ping}
### 最新发布 {#guo-wai-zhu-ji-ce-ping-zui-xin-fa-bu}
<Route author="cnkmmk" example="/zhujiceping" path="/zhujiceping" />