feat(route): add 电脑玩物 (#14486)

* 增加电脑玩物

* style: auto format

* Update radar.js

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
cnkmmk 2024-02-17 23:36:08 +08:00 committed by GitHub
parent f867ada76f
commit 2c20ad3092
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 57 additions and 0 deletions

View File

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

View File

@ -0,0 +1,13 @@
module.exports = {
'playpcesor.com': {
_name: '电脑玩物',
'.': [
{
title: '博客',
docs: 'https://docs.rsshub.app/routes/blog#dian-nao-wan-wu',
source: ['/'],
target: '/playpcesor',
},
],
},
};

View File

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

32
lib/v2/playpcesor/rss.js Normal file
View File

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

View File

@ -312,6 +312,12 @@
| windows | android | tutorial | other |
</Route>
## 电脑玩物 {#dian-nao-wan-wu}
### 博客 {#dian-nao-wan-wu-bo-ke}
<Route author="cnkmmk" example="/playpcesor" path="/playpcesor" radar="1" />
## 纷享销客 CRM {#fen-xiang-xiao-ke-crm}
### 文章 {#fen-xiang-xiao-ke-crm-wen-zhang}