feat: add 小宇宙 (#5187)
This commit is contained in:
@@ -498,15 +498,18 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
||||
如果你在进行上述操作时遇到困难,亦可选择在环境设置中填写明文的用户名和密码:
|
||||
|
||||
- `INITIUM_USERNAME`: 端传媒用户名 (邮箱)
|
||||
|
||||
- `INITIUM_PASSWORD`: 端传媒密码
|
||||
|
||||
- BTBYR
|
||||
|
||||
- `BTBYR_HOST`: 支持 ipv4 访问的 BTBYR 镜像,默认为原站 `https://bt.byr.cn/`。
|
||||
|
||||
- `BTBYR_COOKIE`: 注册用户登录后的 Cookie 值,获取方式:1. 登录后打开网站首页 2. 打开控制台 3. 刷新 4. 找到 <https://bt.byr.cn/index.php> 请求 5. 找到请求头中的 Cookie
|
||||
|
||||
- 小宇宙:需要 App 登陆后抓包获取相应数据。
|
||||
|
||||
- `XIAOYUZHOU_ID`: 即数据包中的 `x-jike-device-id`。
|
||||
- `XIAOYUZHOU_TOKEN`: 即数据包中的 `x-jike-refresh-token`。
|
||||
|
||||
- 新榜
|
||||
|
||||
- `NEWRANK_USERNAME`: 用户名
|
||||
|
||||
@@ -495,6 +495,20 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 小宇宙
|
||||
|
||||
### 发现
|
||||
|
||||
<Route author="prnake" example="/xiaoyuzhou" path="/xiaoyuzhou">
|
||||
|
||||
::: warning 注意
|
||||
|
||||
小宇宙的 api 需要验证 `x-jike-device-id`、`x-jike-access-token` 和 `x-jike-refresh-token` 。必要时需要自行配置,具体见部署文档。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
## 优酷
|
||||
|
||||
### 频道
|
||||
|
||||
@@ -767,6 +767,12 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
<Route author="jackyu1996" example="/ccnu/career" path="/ccnu/career" />
|
||||
|
||||
## 吉林大学
|
||||
|
||||
### 校内通知
|
||||
|
||||
<Route author="276562578" example="/jlu/oa" path="/jlu" />
|
||||
|
||||
## 江南大学
|
||||
|
||||
### 教务处通知
|
||||
|
||||
@@ -144,6 +144,10 @@ const calculateValue = () => {
|
||||
host: envs.BTBYR_HOST || 'https://bt.byr.cn/',
|
||||
cookies: envs.BTBYR_COOKIE,
|
||||
},
|
||||
xiaoyuzhou: {
|
||||
device_id: envs.XIAOYUZHOU_ID,
|
||||
refresh_token: envs.XIAOYUZHOU_TOKEN,
|
||||
},
|
||||
newrank: {
|
||||
username: envs.NEWRANK_USERNAME,
|
||||
password: envs.NEWRANK_PASSWORD,
|
||||
|
||||
@@ -2985,4 +2985,7 @@ router.get('/manxiaosi/book/:id', require('./routes/manxiaosi/book'));
|
||||
// 吉林大学校内通知
|
||||
router.get('/jlu/oa', require('./routes/universities/jlu/oa'));
|
||||
|
||||
// 小宇宙
|
||||
router.get('/xiaoyuzhou', require('./routes/xiaoyuzhou/pickup'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
const got = require('@/utils/got');
|
||||
const config = require('@/config').value;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const device_id = config.xiaoyuzhou.device_id || 'f5d56d9a-8530-49a4-a6d2-cfb4b7a31240';
|
||||
const cache = await ctx.cache.get('XIAOYUZHOU_TOKEN');
|
||||
let refresh_token =
|
||||
cache ||
|
||||
config.xiaoyuzhou.refresh_token ||
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiVzhieXB2dTJtT24xZWNqcEppN2p6R2xhMDBhMHYxellLaHFcL0ZXVWVkdDcxNlh3bnJnOFE0cFpGbVJmVFJQQ29ESWsxMmVuY3RcLzNqQWNjeFU3aTZNbkM4MUtWcUlmWWJJbVBKdXJDTXVYc1dHa2x0SE5TK3llNnJvTldLSWN1M1ZFTGY5WFE0cGhnK2crQld6bFloM2g0VUtONlNKWWlUSGtkaHowd0RJYXIrdTlzOE5PaEJPYXdJXC80NEFZcW41RjJqUXNnU3o1TExDSGtuTENuUFppRXllaTNwcVFwRkgweWFWbk03bmQ2RFhrUmVmUExVMTVpMXcwRnpkXC9wWDEiLCJ2IjozLCJpdiI6IkJiVGFjXC9KTG9BU1NYY0tPMkk3M0JBPT0iLCJpYXQiOjE1OTQ1NzIyOTEuODE2fQ.aQm7A6A1R3P94s88vWBWTbIeek9nJ-q9ztfCB7o1uK0';
|
||||
|
||||
const get_token = await got({
|
||||
method: 'post',
|
||||
url: `https://api.xiaoyuzhoufm.com/app_auth_tokens.refresh`,
|
||||
headers: {
|
||||
Host: `api.xiaoyuzhoufm.com`,
|
||||
applicationid: `app.podcast.cosmos`,
|
||||
'app-version': '1.6.0',
|
||||
'x-jike-device-id': device_id,
|
||||
'x-jike-refresh-token': refresh_token,
|
||||
'user-agent': 'okhttp/4.7.2',
|
||||
},
|
||||
});
|
||||
|
||||
refresh_token = get_token.data['x-jike-refresh-token'];
|
||||
ctx.cache.set('XIAOYUZHOU_TOKEN', refresh_token);
|
||||
|
||||
const access_token = get_token.data['x-jike-access-token'];
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: `https://api.xiaoyuzhoufm.com/v1/editor-pick/list`,
|
||||
headers: {
|
||||
Host: `api.xiaoyuzhoufm.com`,
|
||||
applicationid: `app.podcast.cosmos`,
|
||||
'app-version': '1.6.0',
|
||||
'x-jike-device-id': device_id,
|
||||
'x-jike-access-token': access_token,
|
||||
'user-agent': 'okhttp/4.7.2',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
const playList = [];
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
for (let j = 0; j < data[i].picks.length; j++) {
|
||||
data[i].picks[j].episode.pubDate = data[i].date;
|
||||
playList.push(data[i].picks[j]);
|
||||
}
|
||||
}
|
||||
|
||||
const resultItems = await Promise.all(
|
||||
playList.map(async (item) => {
|
||||
const title = item.episode.title + ' - ' + item.episode.podcast.title;
|
||||
const eid = item.episode.eid;
|
||||
const itunes_item_image = item.episode.image ? item.episode.image.picUrl : item.episode.podcast.image ? item.episode.podcast.image.picUrl : '';
|
||||
const link = 'https://www.xiaoyuzhoufm.com/episode/' + eid;
|
||||
const pubDate = new Date(item.episode.pubDate).toUTCString();
|
||||
const enclosure_length = item.episode.duration;
|
||||
const enclosure_url = item.episode.enclosure.url;
|
||||
const desc = item.episode.shownotes;
|
||||
const author = item.episode.podcast.author;
|
||||
|
||||
const resultItem = {
|
||||
title: title,
|
||||
description: desc,
|
||||
link: link,
|
||||
author: author,
|
||||
pubDate: pubDate,
|
||||
enclosure_url: enclosure_url,
|
||||
enclosure_length: enclosure_length,
|
||||
itunes_item_image: itunes_item_image,
|
||||
enclosure_type: 'audio/mpeg',
|
||||
};
|
||||
return Promise.resolve(resultItem);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '小宇宙 - 发现',
|
||||
link: 'https://www.xiaoyuzhoufm.com/',
|
||||
description: '小宇宙的编辑精选',
|
||||
image: 'https://www.xiaoyuzhoufm.com/apple-touch-icon.png',
|
||||
itunes_author: '小宇宙',
|
||||
itunes_category: 'Society & Culture',
|
||||
item: resultItems,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user