Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): add 大连理工大学公共基础学院 RSS (#13982) #14007

Merged
merged 11 commits into from
Dec 15, 2023
4 changes: 4 additions & 0 deletions lib/v2/dut/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ module.exports = {
// 体育场馆中心:http://tycgzx.dlut.edu.cn
// 默认 -> 通知公告 http://tycgzx.dlut.edu.cn/tzgg/tzgg.htm
tycgzx: 'tzgg/tzgg',

// 公共基础学院:http://fldpj.dlut.edu.cn/index.htm
// 默认 -> 重要通知 http://fldpj.dlut.edu.cn/index/zytz.htm
fldpj: 'index/zytz',
};
30 changes: 21 additions & 9 deletions lib/v2/dut/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module.exports = async (ctx) => {

if (site === 'panjin') {
items = $('a.news').slice(0, -4);
} else if (site === 'fldpj') {
items = $('li[id^="line_u9"]').find('a');
} else {
$('.Next, .rjxw_left, .pb_sys_common').remove();
items = $('.txt, .itemlist, .wall, .list, .list01, .ny_list, .rjxw_right, .rj_yjs_con, .c_hzjl_list1, .winstyle67894, .winstyle80936, .winstyle50738, #lili').find('a');
Expand All @@ -38,18 +40,28 @@ module.exports = async (ctx) => {
.map((item) => {
item = $(item);

const dateRegex = /(\d{4}[-/年]\d{2}[-/月]\d{2})/;
const result = {
link: item.attr('href').startsWith('http') ? item.attr('href') : `${rootUrl}/${item.attr('href').replace(/^[./]+/, '')}`,
};

if (site === 'fldpj') {
result.title = item.find('em').text();
result.pubDate = parseDate(item.find('span').text());
} else {
const dateRegex = /(\d{4}[-/年]\d{2}[-/月]\d{2})/;

let dateMatch = item.parent().text().match(dateRegex);
if (!dateMatch) {
dateMatch = item.parent().parent().text().match(dateRegex);
}

let dateMatch = item.parent().text().match(dateRegex);
if (!dateMatch) {
dateMatch = item.parent().parent().text().match(dateRegex);
result.title = item.text().trim() === '' ? item.next().text() : item.text();
if (dateMatch) {
result.pubDate = parseDate(dateMatch[1].replace(/年|月/g, '-'));
}
}

return {
title: item.text() === '' ? item.next().text() : item.text(),
link: /^http/.test(item.attr('href')) ? item.attr('href') : `${rootUrl}/${item.attr('href').replace(/^[./]+/, '')}`,
pubDate: parseDate(dateMatch ? dateMatch[1].replace(/年|月/g, '-') : new Date().toString()),
};
return result;
});

items = await Promise.all(
Expand Down
15 changes: 8 additions & 7 deletions lib/v2/dut/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module.exports = {
'/news/:category?': ['nczitzk'],
'/perdep/:category?': ['nczitzk'],
'/teach/:category?': ['beautyyuyanli', 'nczitzk'],
'/gs/:category?': ['nczitzk'],
'/ssdut/:category?': ['nczitzk'],
'/dutdice/:category?': ['beautyyuyanli', 'nczitzk'],
'/eda/:category?': ['nczitzk'],
'/fldpj/:category?': ['ueiu'],
'/gs/:category?': ['nczitzk'],
'/news/:category?': ['nczitzk'],
'/panjin/:category?': ['nczitzk'],
'/xsgzb/:category?': ['nczitzk'],
'/perdep/:category?': ['nczitzk'],
'/pjteach/:category?': ['nczitzk'],
'/pjxqzwb/:category?': ['nczitzk'],
'/dutdice/:category?': ['beautyyuyanli', 'nczitzk'],
'/ssdut/:category?': ['nczitzk'],
'/teach/:category?': ['beautyyuyanli', 'nczitzk'],
'/tycgzx/:category?': ['beatyyuyanli', 'nczitzk'],
'/xsgzb/:category?': ['nczitzk'],
};
66 changes: 37 additions & 29 deletions lib/v2/dut/radar.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module.exports = {
'dlut.edu.cn': {
_name: '大连理工大学',
news: [
dutdice: [
{
title: '新闻网',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-xin-wen-wang',
title: '国际合作与交流处(港澳台办)',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-guo-ji-he-zuo-yu-jiao-liu-chu-gang-ao-tai-ban',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
perdep: [
eda: [
{
title: '人事处',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ren-shi-chu',
title: '开发区校区',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-kai-fa-qu-xiao-qu',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
teach: [
fldpj: [
{
title: '教务处',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-jiao-wu-chu',
title: '公共基础学院',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-gong-gong-ji-chu-xue-yuan',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
Expand All @@ -33,18 +33,10 @@ module.exports = {
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
ssdut: [
{
title: '软件学院',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ruan-jian-xue-yuan',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
eda: [
news: [
{
title: '开发区校区',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-kai-fa-qu-xiao-qu',
title: '新闻网',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-xin-wen-wang',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
Expand All @@ -57,10 +49,10 @@ module.exports = {
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
xsgzb: [
perdep: [
{
title: '盘锦校区学生事务办公室',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-pan-jin-xiao-qu-xue-sheng-shi-wu-ban-gong-shi',
title: '人事处',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ren-shi-chu',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
Expand All @@ -81,18 +73,26 @@ module.exports = {
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
tjpj: [
ssdut: [
{
title: '体育与健康学院盘锦分院',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ti-yu-jian-kang-xue-yuan-pan-jin-fen-yuan',
title: '软件学院',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ruan-jian-xue-yuan',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
dutdice: [
teach: [
{
title: '国际合作与交流处(港澳台办)',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-guo-ji-he-zuo-yu-jiao-liu-chu-gang-ao-tai-ban',
title: '教务处',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-jiao-wu-chu',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
tjpj: [
{
title: '体育与健康学院盘锦分院',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-ti-yu-jian-kang-xue-yuan-pan-jin-fen-yuan',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
Expand All @@ -105,5 +105,13 @@ module.exports = {
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
xsgzb: [
{
title: '盘锦校区学生事务办公室',
docs: 'https://docs.rsshub.app/routes/university#da-lian-li-gong-da-xue-pan-jin-xiao-qu-xue-sheng-shi-wu-ban-gong-shi',
source: ['/'],
target: (params, url) => `/dut/${url.match(/:\/\/[\w\d]+\./)[1]}/${url.match(/\.cn\/(.*)\.htm/)[1]}`,
},
],
},
};
5 changes: 5 additions & 0 deletions lib/v2/dut/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ module.exports = {
xwdt: 'xwdt/xwdt',
jkzs: 'jkzs/jkzs1',
},
fldpj: {
xsdt: 'kxyj/xsdt',
zytz: 'index/zytz',
ywgk: 'index/ywgk',
},
};
16 changes: 16 additions & 0 deletions website/docs/routes/university.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,22 @@ Note:[Source website](https://ece.umass.edu/seminar) may be empty when there's
:::
</Route>

### 公共基础学院 {#da-lian-li-gong-da-xue-gong-gong-ji-chu-xue-yuan}

<Route author="ueiu" example="/fldpj" path="/dut/fldpj/:category?" paramsDesc={['分类,见下表,默认为 [**重要通知**](http://fldpj.dlut.edu.cn/index/zytz.htm)']}>

| 重要通知 | 学术动态 | 院务公开 |
| -------- | -------- | -------- |
| zytz | xsdt | ywgk |

:::tip

表格仅呈现了部分分类栏目,更多分类栏目参见 [大连理工大学公共基础学院](http://fldpj.dlut.edu.cn/index.htm),并按照上方 [**通用**](#da-lian-li-gong-da-xue-tong-yong) 规则订阅。

:::

</Route>

## 电子科技大学 {#dian-zi-ke-ji-da-xue}

### 研究生院 {#dian-zi-ke-ji-da-xue-yan-jiu-sheng-yuan}
Expand Down