diff --git a/lib/v2/zrblog/maintainer.js b/lib/v2/zrblog/maintainer.js new file mode 100644 index 000000000..387d961bf --- /dev/null +++ b/lib/v2/zrblog/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['cnkmmk'], +}; diff --git a/lib/v2/zrblog/radar.js b/lib/v2/zrblog/radar.js new file mode 100644 index 000000000..8cca4f907 --- /dev/null +++ b/lib/v2/zrblog/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'zrblog.net': { + _name: '赵容部落', + '.': [ + { + title: '博客', + docs: 'https://docs.rsshub.app/routes/blog#zhao-rong-bu-luo', + source: ['/'], + target: '/zrblog', + }, + ], + }, +}; diff --git a/lib/v2/zrblog/router.js b/lib/v2/zrblog/router.js new file mode 100644 index 000000000..574929e02 --- /dev/null +++ b/lib/v2/zrblog/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./rss')); +}; diff --git a/lib/v2/zrblog/rss.js b/lib/v2/zrblog/rss.js new file mode 100644 index 000000000..ce5ebcd31 --- /dev/null +++ b/lib/v2/zrblog/rss.js @@ -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, + }; +}; \ No newline at end of file diff --git a/website/docs/routes/blog.mdx b/website/docs/routes/blog.mdx index 157ffada8..82c6608bd 100644 --- a/website/docs/routes/blog.mdx +++ b/website/docs/routes/blog.mdx @@ -485,3 +485,9 @@ ### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20} + +## 赵容部落 {#zhao-rong-bu-luo} + +### 博客 {#zhao-rong-bu-luo-bo-ke} + + \ No newline at end of file