feat(route): tongji/bks (#14558)

* feat(route): tongji/bks

* chore: format corrections

* Update lib/v2/tongji/radar.js

---------
This commit is contained in:
shiquda
2024-02-29 11:35:42 +08:00
committed by GitHub
parent 113cf124e5
commit aae92ab9c0
5 changed files with 46 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const link = 'https://bksy.tongji.edu.cn/30359/list.htm';
const response = await got(link);
const $ = cheerio.load(response.data);
const list = $('.wcts-a0018 li');
ctx.state.data = {
title: '同济大学本科生院',
link,
description: '同济大学本科生院通知公告',
item:
list?.toArray().map((item) => {
item = $(item);
const a = item.find('a');
const dateItem = item.find('.li-data');
const yearAndMonth = dateItem.find('span').text().split('-');
const day = dateItem.find('p').text();
const date = `${yearAndMonth[0]}-${yearAndMonth[1]}-${day}`;
return {
title: item.find('.li-tt-title').text(),
description: item.find('.intro').text(),
link: new URL(a.attr('href'), link).href,
pubDate: parseDate(date, 'YYYY-MM-DD')
};
}),
};
};
+2
View File
@@ -1,4 +1,6 @@
module.exports = {
'/bks': ['shiquda'],
'/sse/:type?': ['sgqy'],
'/yjs': ['shengmaosu'],
};
+8
View File
@@ -1,6 +1,14 @@
module.exports = {
'tongji.edu.cn': {
_name: '同济大学',
bksy: [
{
title: '本科生院通知公告',
docs: 'https://docs.rsshub.app/routes/university#tong-ji-da-xue',
source: ['/'],
target: '/tongji/bks',
}
],
sse: [
{
title: '软件学院通知',
+1
View File
@@ -1,4 +1,5 @@
module.exports = (router) => {
router.get('/bks', require('./bks'));
router.get('/sse/:type?', require('./sse/notice'));
router.get('/yjs', require('./yjs'));
};
+4
View File
@@ -2755,6 +2755,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE\_TL
注意: `qttz` 与 `xytz` 在原网站等价.
</Route>
### 本科生院通知公告 {#tong-ji-da-xue-yan-jiu-sheng-yuan-tong-zhi-gong-gao}
<Route author="shiquda" example="/tongji/bks" path="/tongji/bks" radar="1" />
## 潍坊学院 {#wei-fang-xue-yuan}
### 新闻 {#wei-fang-xue-yuan-xin-wen}