mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: new and hot post of 1point3acres (#4369)
This commit is contained in:
@@ -229,6 +229,14 @@ pageClass: routes
|
||||
|
||||
<Route author="Maecenas" example="/1point3acres/user/1/posts" path="/1point3acres/user/:id/posts" :paramsDesc="['用户 id,可在 Instant 版网站的个人主页 URL 找到']"/>
|
||||
|
||||
### 帖子 (手机端的最热与最新 Tab)
|
||||
|
||||
<Route author="NavePnow" example="/1point3acres/post/hot" path="/1point3acres/post/:category" :paramsDesc="['分类 category, 见下表']"/>
|
||||
|
||||
| 最热帖子 | 最新帖子 |
|
||||
| -------- | -------- |
|
||||
| hot | new |
|
||||
|
||||
### 录取结果
|
||||
|
||||
<Route author="NavePnow" example="/1point3acres/offer/12/null/CMU" path="/1point3acres/offer/:year?/:major?/:school?" :paramsDesc="['录取年份 id,空为null', '录取专业 id,空为null', '录取学校 id,空为null']">
|
||||
|
||||
@@ -1421,6 +1421,7 @@ router.get('/vocus/user/:id', require('./routes/vocus/user'));
|
||||
router.get('/1point3acres/user/:id/threads', require('./routes/1point3acres/threads'));
|
||||
router.get('/1point3acres/user/:id/posts', require('./routes/1point3acres/posts'));
|
||||
router.get('/1point3acres/offer/:year?/:major?/:school?', require('./routes/1point3acres/offer'));
|
||||
router.get('/1point3acres/post/:category', require('./routes/1point3acres/post'));
|
||||
|
||||
// 广东海洋大学
|
||||
router.get('/gdoujwc', require('./routes/universities/gdou/jwc/jwtz'));
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category;
|
||||
let url;
|
||||
let method;
|
||||
let description;
|
||||
let { title } = 'null';
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (title == 'null') {
|
||||
method = 'get';
|
||||
}
|
||||
// eslint-disable-next-line eqeqeq
|
||||
category == 'new'
|
||||
? ((url = 'https://api.1point3acres.com/api/threads?type=new&pg=1&ps=20&includes=last_reply'), (title = '最新帖子'))
|
||||
: ((url = 'https://api.1point3acres.com/api/threads?type=hot&pg=1&ps=20&includes=last_reply'), (title = '最热帖子'));
|
||||
const responseBasic = await got({
|
||||
method: method,
|
||||
url: url,
|
||||
});
|
||||
const data = responseBasic.data.threads;
|
||||
ctx.state.data = {
|
||||
title: `${title} - 一亩三分地`,
|
||||
link: `https://www.1point3acres.com/bbs/`,
|
||||
description: `${title} - 一亩三分地`,
|
||||
item: data.map((item) => {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
item.last_reply.quote == '' ? (description = item.last_reply.message_bbcode) : (description = item.last_reply.quote);
|
||||
return {
|
||||
title: `${item.subject}`,
|
||||
// description: item.last_reply.message_bbcode,// + `<b>楼主:</b>` + item.author,
|
||||
description: description,
|
||||
// pubDate: new Date(item.submittime + ' GMT+8').toUTCString(),
|
||||
link: `https://instant.1point3acres.com/thread/${item.tid}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user