diff --git a/lib/routes/zhujiceping/maintainer.js b/lib/routes/zhujiceping/maintainer.js new file mode 100644 index 0000000000..387d961bfe --- /dev/null +++ b/lib/routes/zhujiceping/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['cnkmmk'], +}; diff --git a/lib/routes/zhujiceping/radar.js b/lib/routes/zhujiceping/radar.js new file mode 100644 index 0000000000..5ea1b8e747 --- /dev/null +++ b/lib/routes/zhujiceping/radar.js @@ -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', + }, + ], + }, +}; diff --git a/lib/routes/zhujiceping/router.js b/lib/routes/zhujiceping/router.js new file mode 100644 index 0000000000..09c585b573 --- /dev/null +++ b/lib/routes/zhujiceping/router.js @@ -0,0 +1,3 @@ +export default (router) => { + router.get('/', './rss'); +}; diff --git a/lib/routes/zhujiceping/rss.js b/lib/routes/zhujiceping/rss.js new file mode 100644 index 0000000000..7c75304996 --- /dev/null +++ b/lib/routes/zhujiceping/rss.js @@ -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, + }); +}; diff --git a/website/docs/routes/blog.mdx b/website/docs/routes/blog.mdx index 84aa4d03b2..f0c431f15a 100644 --- a/website/docs/routes/blog.mdx +++ b/website/docs/routes/blog.mdx @@ -491,3 +491,9 @@ ### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20} + +## 国外主机测评 {#guo-wai-zhu-ji-ce-ping} + +### 最新发布 {#guo-wai-zhu-ji-ce-ping-zui-xin-fa-bu} + +