add 423down (#8756)

This commit is contained in:
Fatpandac 2022-01-23 03:50:03 +08:00 committed by GitHub
parent 05f0a4b870
commit 3c736f5beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 337 additions and 0 deletions

View File

@ -64,6 +64,30 @@ pageClass: routes
</Route>
## 423Down
### 分类
<Route author="Fatpandac" exmaple="/423down/index/all" path="/423down/:category/:type" :paramsDesc="['类型', '分类']" radar="1">
| category | 全部 |
| :------: | :--: |
| index | all |
| category | 安卓软件 |
| :------: | :------: |
| android | apk |
| category | 原创软件 | 媒体播放 | 网页浏览 | 图形图像 | 聊天软件 | 办公软件 | 上传下载 | 系统辅助 | 系统必备 | 安全软件 | 补丁相关 | 硬件相关 |
| :------: | :----------: | :--------: | :------: | :------: | :------: | :------: | :------: | :--------: | :--------: | :------: | :------: | :------: |
| computer | originalsoft | multimedia | browser | image | im | work | down | systemsoft | systemplus | security | patch | hardware |
| category | windows 11 | windows 10 | windows 7 | windows xp | windows pe |
| :------: | :--------: | :--------: | :-------: | :--------: | :--------: |
| os | win11 | win10 | win7 | winxp | winpe |
</Route>
## A 岛匿名版
### 串

114
lib/v2/423down/index.js Normal file
View File

@ -0,0 +1,114 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const rootUrl = 'https://www.423down.com';
const categeoryMap = {
index: {
all: '',
},
android: {
apk: 'apk',
},
computer: {
originalsoft: 'zd423',
multimedia: 'multimedia',
browser: 'browser',
image: 'image',
im: 'im',
work: 'work',
down: 'down',
systemsoft: 'systemsoft',
systemplus: 'systemplus',
security: 'security',
patch: 'patch',
hardware: 'hardware',
},
os: {
win11: 'win11',
win10: 'win10',
win7: 'win7',
winxp: 'winxp',
winpe: 'pe-system',
},
};
const titleMap = {
index: {
all: '首页',
},
android: {
apk: '安卓软件',
},
computer: {
originalsoft: '原创软件',
multimedia: '媒体播放',
browser: '网页浏览',
image: '图形图像',
im: '聊天软件',
work: '办公软件',
down: '上传下载',
systemsoft: '系统辅助',
systemplus: '系统必备',
security: '安全软件',
patch: '补丁相关',
hardwork: '硬件相关',
},
os: {
win11: 'windows 11',
win10: 'Windows 10',
win7: 'Windows 7',
winxp: 'Windows XP',
winpe: 'Windows PE',
},
};
module.exports = async (ctx) => {
const { category, type } = ctx.params;
const url = `${rootUrl}/${categeoryMap[category][type]}`;
const response = await got.get(url);
const $ = cheerio.load(response.data);
const list = $('div.content-wrap > div > ul > li > a')
.filter((_, item) => {
const notAnotherWebPage = $(item).attr('style') !== 'display: none !important;';
return notAnotherWebPage;
})
.map((_, item) => ({
link: $(item).attr('href'),
}))
.get();
const items = await Promise.all(
list.map(async (item) => {
item = await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got.get(item.link);
const $ = cheerio.load(detailResponse.data);
const title = $('div.content-wrap > div > div.meta > h1 > a').text();
const pageContent = $('div.content-wrap > div > div.entry').html();
const pageComments = $('#postcomments > ol').html();
const desc = pageContent + pageComments;
const date = $('div.content-wrap > div > div.meta > p').text();
const categeory = $('div.content-wrap > div > div.meta > p > a:not(.comm)').text();
item.title = title;
item.description = desc;
item.categeory = categeory;
item.pubDate = parseDate(date.split(' ')[0], 'YYYY-MM-DD');
return item;
});
return item;
})
);
ctx.state.data = {
title: `423down-${titleMap[category][type]}`,
link: url,
item: items,
};
};

View File

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

193
lib/v2/423down/radar.js Normal file
View File

@ -0,0 +1,193 @@
module.exports = {
'423down.com': {
_name: '423down',
www: [
{
title: '首页',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/',
target: '/423down/index/all',
},
{
title: '安卓软件',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'apk') {
return '/423down/android/apk';
}
},
},
{
title: '原创软件',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'zd423') {
return '/423down/computer/originalsoft';
}
},
},
{
title: '媒体播放',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'multimedia') {
return '/423down/computer/multimedia';
}
},
},
{
title: '网页浏览',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'browser') {
return '/423down/computer/browser';
}
},
},
{
title: '图形图像',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'image') {
return '/423down/computer/image';
}
},
},
{
title: '聊天软件',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'im') {
return '/423down/computer/im';
}
},
},
{
title: '办公软件',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'work') {
return '/423down/computer/work';
}
},
},
{
title: '上传下载',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'down') {
return '/423down/computer/down';
}
},
},
{
title: '系统辅助',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'systemsoft') {
return '/423down/computer/systemsoft';
}
},
},
{
title: '系统必备',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'systemplus') {
return '/423down/computer/systemplus';
}
},
},
{
title: '安全软件',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'security') {
return '/423down/computer/security';
}
},
},
{
title: '补丁相关',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'patch') {
return '/423down/computer/patch';
}
},
},
{
title: '硬件相关',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'hardwork') {
return '/423down/computer/hardware';
}
},
},
{
title: 'windows 11',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'win11') {
return '/423down/os/win11';
}
},
},
{
title: 'windows 10',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'win10') {
return '/423down/os/win10';
}
},
},
{
title: 'windows 7',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'win7') {
return '/423down/os/win7';
}
},
},
{
title: 'windows xp',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'winxp') {
return '/423down/os/winxp';
}
},
},
{
title: 'windows pe',
docs: 'https://docs.rsshub.app/bbs.html#_423down',
source: '/:type',
target: (params) => {
if (params.type === 'winpe') {
return '/423down/os/winpe';
}
},
},
],
},
};

3
lib/v2/423down/router.js Normal file
View File

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