feat(route): add PKMer (#14103)

* feat(route): PKMer

* style: auto format

* Update lib/v2/pkmer/recent.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/v2/pkmer/radar.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update bbs.mdx

* Update lib/v2/pkmer/recent.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
YONG 2023-12-24 07:18:45 +08:00 committed by GitHub
parent 8e49c5df65
commit 30ed60da40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module.exports = {
'/recent': ['Gnoyong'],
};

13
lib/v2/pkmer/radar.js Normal file
View File

@ -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',
},
],
},
};

36
lib/v2/pkmer/recent.js Normal file
View File

@ -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;
}

3
lib/v2/pkmer/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/recent', require('./recent.js'));
};

View File

@ -254,6 +254,12 @@ If you opt to enable `fulltext` feature, consider adding `limit` parameter to yo
<Route author="TonyRL" example="/pikabu/user/@Eujenu" path="/pikabu/user/:name" paramsDesc={['User name']} radar="1" notOperational="1" />
## PKMer {#pkmer}
### 最近更新 {#pkmer-zui-jin-geng-xin}
<Route author="Gnoyong" example="/pkmer/recent" path="/pkmer/recent" radar="1" />
## PLAYNO.1 玩樂達人 {#playno-1-wan-le-da-ren}
### AV {#playno-1-wan-le-da-ren-av}