feat: a岛匿名版 (#4414)

This commit is contained in:
短狐
2020-04-13 19:38:26 +08:00
committed by GitHub
parent 99a29f2c09
commit 31d9d4d2d6
3 changed files with 82 additions and 0 deletions

View File

@@ -261,3 +261,37 @@ pageClass: routes
### 回帖 ### 回帖
<Route author="LogicJake" example="/zhibo8/post/2601615" path="/zhibo8/post/:id" :paramsDesc="['帖子 id可在帖子 URL 找到']"/> <Route author="LogicJake" example="/zhibo8/post/2601615" path="/zhibo8/post/:id" :paramsDesc="['帖子 id可在帖子 URL 找到']"/>
## a 岛匿名版
### 串
<Route author="zcx1218029121" example="/adnmb/20/1" path="/adnmb/:pid/page" :paramsDesc="['板块列表,见下表','页数, 1开始必填']" >
| 综合版 1 | 围炉 | 欢乐恶搞 | 速报 2 | 推理 | 跑团 | 技术宅 | 料理 | 猫版 | 音乐 | 考试 | 社畜 |
| -------- | ---- | -------- | ------ | ---- | ---- | ------ | ---- | ---- | ---- | ---- | ---- |
| 4 | 120 | 20 | 121 | 11 | 111 | 30 | 32 | 40 | 35 | 56 | 110 |
| 科学 | 文学 | 创意 | 姐妹 1 | 数码 | 女装 | 日记 | 圈内 | 都市怪谈 | 买买买 | 动画 | 漫画 | 美漫 | 国漫 | 小说 |
| ---- | ---- | ---- | ------ | ---- | ---- | ---- | ---- | -------- | ------ | ---- | ---- | ---- | ---- | ---- |
| 15 | 103 | 17 | 98 | 75 | 97 | 89 | 96 | 81 | 106 | 14 | 12 | 90 | 99 | 19 |
| 轻小说 | GALGAME | 东方 Project | 舰娘 | 虚拟偶像 | VOCALOID | 游戏 | DNF | SE | 手游 |
| ------ | ------- | ------------ | ---- | -------- | -------- | ---- | --- | --- | ---- |
| 87 | 64 | 5 | 93 | 101 | 6 | 2 | 72 | 124 | 3 |
| Steam | 索尼 | LOL | DOTA | 口袋妖怪 | 战争雷霆 | WOT | Minecraft | 怪物猎人 | 3A 游戏 |
| ----- | ---- | --- | ---- | -------- | -------- | --- | --------- | -------- | ------- |
| 107 | 24 | 22 | 70 | 38 | 86 | 51 | 10 | 28 | 108 |
| 彩虹六号 | 暴雪游戏 | 卡牌桌游 | MUG | AC 大逃杀 | 任天堂 | AKB | SNH48 | COSPLAY | 声优 |
| -------- | -------- | -------- | --- | --------- | ------ | --- | ----- | ------- | ---- |
| 119 | 23 | 45 | 34 | 29 | 25 | 16 | 100 | 13 | 55 |
| 模型 | 影视 | 军武 | 体育 | 值班室 | 城墙 | 技术支持 | 询问 3 | 宠物 | 摄影 2 |
| ---- | ---- | ---- | ---- | ------ | ---- | -------- | ------ | ---- | ------ |
| 39 | 31 | 37 | 33 | 18 | 112 | 117 | 114 | 118 | 115 |
| 主播 | 育儿 | 围炉 | 旅行 | 特摄 |
| ---- | ---- | ---- | ---- | ---- |
| 116 | 113 | 120 | 125 | 9 |

View File

@@ -2517,4 +2517,7 @@ router.get('/hbut/cs/:type', require('./routes/universities/hbut/cs'));
// acwifi // acwifi
router.get('/acwifi', require('./routes/acwifi')); router.get('/acwifi', require('./routes/acwifi'));
// a岛匿名版
router.get('/adnmb/:pid/:page', require('./routes/adnmb/index'));
module.exports = router; module.exports = router;

45
lib/routes/adnmb/index.js Normal file
View File

@@ -0,0 +1,45 @@
// a岛匿名版
const got = require('@/utils/got');
module.exports = async (ctx) => {
const pid = ctx.params.pid;
const page = ctx.params.page;
const url = `https://adnmb2.com/Api/showf?id=${pid}&page=${page}`;
const response = await got({
method: 'get',
url: url,
});
const data = response.data;
const items = [];
data.forEach((item) => {
const newItems = { title: item.content, pubDate: '${item.now}', link: `https://adnmb2.com/t/${item.id}` };
const img = item.img !== '' ? '<img src="https://nmbimg.fastmirror.org/thumb/' + item.img + item.ext + '"/>' : '';
let replys = '';
item.replys.forEach((reply) => {
const replyImg = reply.img !== '' ? '<img src="https://nmbimg.fastmirror.org/thumb/' + reply.img + reply.ext + '"/>' : '';
replys += `<h4>${reply.title} ${reply.name} ${reply.now} ID:${reply.userid} No.${reply.id}</h4> </br>
${reply.content}
${replyImg}
<hr />
`;
});
newItems.description = `<h2>${item.title} ${item.name} ${item.now} ID:${item.userid} No.${item.id}</h2> </br>
${item.content}
${img}
<hr />
${replys}
`;
items.push(newItems);
});
ctx.state.data = {
// 源标题
title: `a岛匿名版`,
// 源链接
link: `https://adnmb2.com/Forum`,
// 源说明
description: `A岛是一个前台匿名后台实名的论坛`,
// 遍历此前获取的数据
item: items,
};
};