feat(route): add WizFile (#10474)

This commit is contained in:
Fatpandac 2022-08-16 00:26:43 +08:00 committed by GitHub
parent 34c0bdee51
commit d3aa59447a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 0 deletions

View File

@ -531,6 +531,12 @@ Language
<RouteEn author="nczitzk" example="/diskanalyzer/whats-new" path="/diskanalyzer/whats-new"/>
## WziFile
### Version History
<RouteEn author="Fatpandac" example="/wizfile/updates" path="/wizfile/updates"/>
## X410
### News

View File

@ -618,6 +618,12 @@ pageClass: routes
<Route author="nczitzk" example="/diskanalyzer/whats-new" path="/diskanalyzer/whats-new"/>
## WziFile
### 更新日志
<Route author="Fatpandac" example="/wizfile/updates" path="/wizfile/updates"/>
## X410
### News

41
lib/v2/wizfile/index.js Normal file
View File

@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const rootUrl = 'https://antibody-software.com';
module.exports = async (ctx) => {
const currentUrl = `${rootUrl}/wizfile/download`;
const response = await got(currentUrl);
const $ = cheerio.load(response.data);
const items = $('section.blog-section > div > div > div > h4')
.map((_, item) => {
const title = $(item)
.text()
.replace(/\(.*?\)/, '');
const pubDate = parseDate(
$(item)
.find('span')
.text()
.match(/\((.*?)\)/)[1]
);
const description = $(item).next().html();
return {
title,
description,
pubDate,
guid: `${currentUrl}${title}`,
};
})
.get();
ctx.state.data = {
title: `WziFile - 更新日志`,
link: currentUrl,
item: items,
};
};

View File

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

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

@ -0,0 +1,13 @@
module.exports = {
'antibody-software.com': {
_name: 'WizFile',
'.': [
{
title: '更新日志',
docs: 'https://docs.rsshub.app/new-media.html#wei-ji-xin-wen',
source: ['/wizfile/download'],
target: '/wizfile/updates',
},
],
},
};

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

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