diff --git a/lib/v2/pkmer/maintainer.js b/lib/v2/pkmer/maintainer.js new file mode 100644 index 000000000..01de10bd6 --- /dev/null +++ b/lib/v2/pkmer/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/recent': ['Gnoyong'], +}; diff --git a/lib/v2/pkmer/radar.js b/lib/v2/pkmer/radar.js new file mode 100644 index 000000000..5b3f9382c --- /dev/null +++ b/lib/v2/pkmer/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'pkmer.cn': { + _name: 'PKMer', + '.': [ + { + title: '最近更新', + docs: 'https://docs.rsshub.app/routes/bbs#pkmer-zui-jin-geng-xin', + source: ['/page/*'], + target: '/pkmer/recent', + }, + ], + }, +}; diff --git a/lib/v2/pkmer/recent.js b/lib/v2/pkmer/recent.js new file mode 100644 index 000000000..8989f6886 --- /dev/null +++ b/lib/v2/pkmer/recent.js @@ -0,0 +1,36 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +const baseUrl = 'https://pkmer.cn'; + +module.exports = async (ctx) => { + const { data: response } = await got(`${baseUrl}/page/1/`); + const $ = cheerio.load(response); + const items = process($); + + ctx.state.data = { + title: 'PKMer', + icon: 'https://cdn.pkmer.cn/covers/logo.png!nomark', + logo: 'https://cdn.pkmer.cn/covers/logo.png!nomark', + link: baseUrl, + allowEmpty: true, + item: items, + }; +}; + +function process($) { + const container = $('#pages > div.grid > .relative'); + const items = container.toArray().map((el) => { + el = $(el); + const title = el.find('h3'); + return { + title: title.text().trim(), + link: baseUrl + title.parent().attr('href'), + description: el.find('.leading-relaxed').prop('outerHTML') + el.find('.post-content').prop('outerHTML'), + pubDate: el.find('time').attr('datetime'), + author: el.find('h4').text().trim(), + itunes_item_image: el.find('img').attr('src'), + }; + }); + return items; +} diff --git a/lib/v2/pkmer/router.js b/lib/v2/pkmer/router.js new file mode 100644 index 000000000..87c73eeb7 --- /dev/null +++ b/lib/v2/pkmer/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/recent', require('./recent.js')); +}; diff --git a/website/docs/routes/bbs.mdx b/website/docs/routes/bbs.mdx index 6fb809e85..f56facd1b 100644 --- a/website/docs/routes/bbs.mdx +++ b/website/docs/routes/bbs.mdx @@ -254,6 +254,12 @@ If you opt to enable `fulltext` feature, consider adding `limit` parameter to yo +## PKMer {#pkmer} + +### 最近更新 {#pkmer-zui-jin-geng-xin} + + + ## PLAYNO.1 玩樂達人 {#playno-1-wan-le-da-ren} ### AV {#playno-1-wan-le-da-ren-av}