fix(route): bupt (#7489)

This commit is contained in:
zekin 2021-05-25 21:33:59 +08:00 committed by GitHub
parent e1e36334d2
commit 8bb8e1fcb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 0 deletions

View File

@ -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/`

View File

@ -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"/>

View File

@ -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,

View File

@ -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;

View File

@ -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;