Skip to content

Commit

Permalink
fix(route): bupt (DIYgod#7489)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzekin authored May 25, 2021
1 parent e1e3633 commit 8bb8e1f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,15 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行

注意,暂不支持两步验证。

- BUPT

- `BUPT_PORTAL_COOKIE`: 登录后获得的 Cookie 值, 获取方式
1. 打开<https://webapp.bupt.edu.cn/wap/login.html?redirect=https://>并登录
2. 无视掉报错,并打开 <https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p-1&type=xnxw>
3. 打开控制台,刷新
4. 找到 <https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p-1&type=xnxw> 请求
5. 找到请求头中的 Cookie

- BTBYR

- `BTBYR_HOST`: 支持 ipv4 访问的 BTBYR 镜像,默认为原站 `https://bt.byr.cn/`
Expand Down
12 changes: 12 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,22 @@ pageClass: routes

<Route author="RicardoMing wzekin" example="/bupt/portal" path="/bupt/portal" />

::: warning 注意

由于需要登陆 `https://webapp.bupt.edu.cn/wap/login.html?redirect=http://` 后的 Cookie 值,所以只能自建,详情见部署页面的配置模块

:::

### 校园新闻

<Route author="wzekin" example="/bupt/news" path="/bupt/news" />

::: warning 注意

由于需要登陆 `https://webapp.bupt.edu.cn/wap/login.html?redirect=http://` 后的 Cookie 值,所以只能自建,详情见部署页面的配置模块

:::

### BTBYR 趣味盒

<Route author="prnake" example="/bupt/funbox" path="/bupt/funbox" selfhost="1"/>
Expand Down
3 changes: 3 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const calculateValue = () => {
pkubbs: {
cookie: envs.PKUBBS_COOKIE,
},
bupt: {
portal_cookie: envs.BUPT_PORTAL_COOKIE,
},
nhentai: {
username: envs.NHENTAI_USERNAME,
password: envs.NHENTAI_PASSWORD,
Expand Down
7 changes: 7 additions & 0 deletions lib/routes/universities/bupt/news.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
const config = require('@/config').value;
const got = require('@/utils/got');

module.exports = async (ctx) => {
const cookie = config.bupt.portal_cookie;
const headers = {};
if (cookie) {
headers.cookie = cookie;
}
const response = await got({
method: 'get',
url: `https://webapp.bupt.edu.cn/extensions/wap/news/get-list.html?p=1&type=xnxw`,
headers,
});
const out = [];
const data = response.data.data;
Expand Down
7 changes: 7 additions & 0 deletions lib/routes/universities/bupt/portal.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
const config = require('@/config').value;
const got = require('@/utils/got');

module.exports = async (ctx) => {
const cookie = config.bupt.portal_cookie;
const headers = {};
if (cookie) {
headers.cookie = cookie;
}
const response = await got({
method: 'get',
url: `https://webapp.bupt.edu.cn/extensions/wap/news/get-list.html?p=1&type=tzgg`,
headers,
});
const out = [];
const data = response.data.data;
Expand Down

0 comments on commit 8bb8e1f

Please sign in to comment.