diff --git a/lib/v2/playpcesor/maintainer.js b/lib/v2/playpcesor/maintainer.js new file mode 100644 index 000000000..387d961bf --- /dev/null +++ b/lib/v2/playpcesor/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['cnkmmk'], +}; diff --git a/lib/v2/playpcesor/radar.js b/lib/v2/playpcesor/radar.js new file mode 100644 index 000000000..804427e50 --- /dev/null +++ b/lib/v2/playpcesor/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'playpcesor.com': { + _name: '电脑玩物', + '.': [ + { + title: '博客', + docs: 'https://docs.rsshub.app/routes/blog#dian-nao-wan-wu', + source: ['/'], + target: '/playpcesor', + }, + ], + }, +}; diff --git a/lib/v2/playpcesor/router.js b/lib/v2/playpcesor/router.js new file mode 100644 index 000000000..574929e02 --- /dev/null +++ b/lib/v2/playpcesor/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./rss')); +}; diff --git a/lib/v2/playpcesor/rss.js b/lib/v2/playpcesor/rss.js new file mode 100644 index 000000000..6e37e0e42 --- /dev/null +++ b/lib/v2/playpcesor/rss.js @@ -0,0 +1,32 @@ +const { parseDate } = require('@/utils/parse-date'); +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'https://www.playpcesor.com/'; + const response = await got({ method: 'get', url }); + const $ = cheerio.load(response.data); + + const list = $("article[class='post-outer-container']") + .map((i, e) => { + const element = $(e); + const title = element.find('h3 > a').text(); + const link = element.find('h3 > a').attr('href'); + const description = element.find('div[class="snippet-item r-snippetized"]').text(); + const dateraw = element.find('time').attr('datetime'); + + return { + title, + description, + link, + pubDate: parseDate(dateraw, 'YYYY-MM-DDTHH:mm:ss+08:00'), + }; + }) + .get(); + + ctx.state.data = { + title: '电脑玩物', + link: url, + item: list, + }; +}; diff --git a/website/docs/routes/blog.mdx b/website/docs/routes/blog.mdx index 78cdebcc5..a0508e8f8 100644 --- a/website/docs/routes/blog.mdx +++ b/website/docs/routes/blog.mdx @@ -312,6 +312,12 @@ | windows | android | tutorial | other | +## 电脑玩物 {#dian-nao-wan-wu} + +### 博客 {#dian-nao-wan-wu-bo-ke} + + + ## 纷享销客 CRM {#fen-xiang-xiao-ke-crm} ### 文章 {#fen-xiang-xiao-ke-crm-wen-zhang}