mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: create route of 1point3acres offer (#3621)
This commit is contained in:
15
docs/bbs.md
15
docs/bbs.md
@@ -175,6 +175,21 @@ pageClass: routes
|
||||
|
||||
<Route author="Maecenas" example="/1point3acres/user/1/posts" path="/1point3acres/user/:id/posts" :paramsDesc="['用户 id,可在 Instant 版网站的个人主页 URL 找到']"/>
|
||||
|
||||
### 录取结果
|
||||
|
||||
<Route author="NavePnow" example="/1point3acres/offer/12/1/CMU" path="/1point3acres/offer/:year?/:major?/:school?" :paramsDesc="['录取年份 id ', '录取专业 id', '录取学校 id']">
|
||||
::: warning 三个 id 获取方式
|
||||
|
||||
1. 打开 https://offer.1point3acres.com
|
||||
2. 打开控制台
|
||||
3. 切换到 Network 面板
|
||||
4. 点击 搜索 按钮
|
||||
5. 点击 results?ps=15&pg=1 POST 请求
|
||||
6. 找到 Request Payload 请求参数,例如 filters: {planyr: "13", planmajor: "1", outname_w: "ACADIAU"} ,则三个 id 分别为: 13,1,ACADIAU
|
||||
|
||||
:::
|
||||
</Route>
|
||||
|
||||
## 直播吧
|
||||
|
||||
### 子论坛
|
||||
|
||||
@@ -1345,6 +1345,7 @@ router.get('/vocus/user/:id', require('./routes/vocus/user'));
|
||||
// 一亩三分地 1point3acres
|
||||
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('/gdoujwc', require('./routes/universities/gdou/jwc/jwtz'));
|
||||
|
||||
204
lib/routes/1point3acres/offer.js
Normal file
204
lib/routes/1point3acres/offer.js
Normal file
@@ -0,0 +1,204 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// const { id } = ctx.params;
|
||||
// const { year } = ctx.params.year || 'null';
|
||||
// year 2017-2022
|
||||
// 2017:6 2018:11 2019:12 2020:13 2021:14 2022:15
|
||||
// const { major } = ctx.params.major || 'null';
|
||||
// CS:1 MIS:2
|
||||
// const { school } = ctx.params.school || 'null';
|
||||
const year = ctx.params.year || 'null';
|
||||
const major = ctx.params.major || 'null';
|
||||
const school = ctx.params.school || 'null';
|
||||
// school == 'null' ? outname_w : 'CMU'
|
||||
const url = 'https://api.1point3acres.com/offer/results?ps=15&pg=1';
|
||||
// const filter = '{"filters": {"planyr": "12", "planmajor": "1", "outname_w": "CMU"}}';
|
||||
// const filter = 'filters: {planyr: "12", planmajor: "1", outname_w: "CMU"}';
|
||||
let responseBasic;
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (year == 'null') {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (major == 'null') {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (school == 'null') {
|
||||
// year空 major空 school空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// year空 major空 school不空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
outname_w: school,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// year空 major不空
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (school == 'null') {
|
||||
// year空 major不空 school空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planmajor: major,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// year空 major不空 school不空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planmajor: major,
|
||||
outname_w: school,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (major == 'null') {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (school == 'null') {
|
||||
// year不空 major空 school空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planyr: year,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// year不空 major空 school不空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planyr: year,
|
||||
outname_w: school,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (school == 'null') {
|
||||
// year不空 major不空 school空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planyr: year,
|
||||
planmajor: major,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// year不空 major不空 school不空
|
||||
responseBasic = await got({
|
||||
method: 'post',
|
||||
url: url,
|
||||
json: true,
|
||||
data: {
|
||||
filters: {
|
||||
planyr: year,
|
||||
planmajor: major,
|
||||
outname_w: school,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = responseBasic.data.results;
|
||||
// let responseBasic_1;
|
||||
// responseBasic_1 = await got({
|
||||
// method: 'get',
|
||||
// url: `https://api.1point3acres.com/offer/results/A7m20e4g/backgrounds`,
|
||||
// headers: {
|
||||
// authorization: `eyJhbGciOiJIUzUxMiIsImlhdCI6MTU3Njk5Njc5OSwiZXhwIjoxNTg0ODU5MTk5fQ.eyJ1aWQiOjQ1NzQyN30.0ei5UE6OgLBzN2_IS7xUIbIfW_S1Wzl42q2UeusbboxuzvctO_4Mz6YRr6f0PBLUVZMETxt8F0_4-yqIJ3_kUQ`,
|
||||
// },
|
||||
// });
|
||||
// const tid = responseBasic_1.data.background.tid;
|
||||
ctx.state.data = {
|
||||
title: `录取结果 - 一亩三分地`,
|
||||
link: `https://offer.1point3acres.com`,
|
||||
description: `录取结果 - 一亩三分地`,
|
||||
item: data.map((item) => ({
|
||||
title: item.planyr + `年` + item.planmajor + `@` + item.outname_w + ` ` + item.result + ` - 一亩三分地`, // `${year_result}年${major_result}@${outname_w_result} ${result_result}`,
|
||||
description:
|
||||
`<b>国家:</b>` +
|
||||
item.country +
|
||||
`<br>` +
|
||||
`<b>学校:</b>` +
|
||||
item.outname_w +
|
||||
` ` +
|
||||
item.outname +
|
||||
'<br>' +
|
||||
`<b>录取学位:</b>` +
|
||||
item.plandegree +
|
||||
'<br>' +
|
||||
`<b>录取项目:</b>` +
|
||||
item.planmajor +
|
||||
`-` +
|
||||
item.planprogram +
|
||||
'<br>' +
|
||||
`<b>录取结果:</b>` +
|
||||
item.result +
|
||||
'<br>' +
|
||||
`<b>录取时间:</b>` +
|
||||
item.outtime +
|
||||
'<br>' +
|
||||
`<b>通知方式:</b>` +
|
||||
item.noticemethod +
|
||||
'<br>' +
|
||||
`<b>全奖/自费:</b>` +
|
||||
item.planfin +
|
||||
'<br>' +
|
||||
`<b>申入学学期:</b>` +
|
||||
item.planterm +
|
||||
'<br>' +
|
||||
`<b>申入学年度:</b>` +
|
||||
item.planyr +
|
||||
'<br>' +
|
||||
`<b>提交时间:</b>` +
|
||||
item.submittime +
|
||||
'<br>',
|
||||
pubDate: new Date(item.submittime + ' GMT+8').toUTCString(),
|
||||
link: `https://offer.1point3acres.com`,
|
||||
// responseBasic_1 =await got({
|
||||
// method: 'get',
|
||||
// url: `https://api.1point3acres.com/offer/results/${item.id}/backgrounds`,
|
||||
// headers: {
|
||||
// authorization: `eyJhbGciOiJIUzUxMiIsImlhdCI6MTU3Njk5Njc5OSwiZXhwIjoxNTg0ODU5MTk5fQ.eyJ1aWQiOjQ1NzQyN30.0ei5UE6OgLBzN2_IS7xUIbIfW_S1Wzl42q2UeusbboxuzvctO_4Mz6YRr6f0PBLUVZMETxt8F0_4-yqIJ3_kUQ`,
|
||||
// },
|
||||
// }).data.data.background.tid,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user