mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: university lixin.edu.cn route (#4645)
This commit is contained in:
@@ -276,7 +276,7 @@ pageClass: routes
|
|||||||
|
|
||||||
### 最新
|
### 最新
|
||||||
|
|
||||||
<Route author="KenMizz" example="/ssmh" path="/ssmh/">
|
<Route author="KenMizz" example="/ssmh" path="/ssmh/" />
|
||||||
|
|
||||||
## 鼠绘漫画
|
## 鼠绘漫画
|
||||||
|
|
||||||
|
|||||||
@@ -1142,6 +1142,40 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
|
|||||||
|
|
||||||
<Route author="HenryQW" example="/shanghaitech/sist/activity" path="/shanghaitech/sist/activity"/>
|
<Route author="HenryQW" example="/shanghaitech/sist/activity" path="/shanghaitech/sist/activity"/>
|
||||||
|
|
||||||
|
## 上海立信会计金融学院
|
||||||
|
|
||||||
|
::: warning 注意
|
||||||
|
|
||||||
|
分区 ID 是`info/iList.jsp?cat_id=`后方数字
|
||||||
|
|
||||||
|
目前仅支持文章分区的识别
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
### 官网
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/tzgg/12707" path="/slu/tzgg/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
|
### 教务处
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/jwc/13424" path="/slu/jwc/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
|
### 学生处
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/xsc/14751" path="/slu/xsc/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
|
### 会计学院
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/kjxy/13496" path="/slu/kjxy/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
|
### 财税与公共管理学院
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/csggxy/14751" path="/slu/csggxy/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
|
### 体育与健康学院
|
||||||
|
|
||||||
|
<Route author="NeverBehave" example="/slu/tyyjkxy/14754" path="/slu/tyyjkxy/:id" :paramsDesc="['类别ID']" />
|
||||||
|
|
||||||
## 深圳大学
|
## 深圳大学
|
||||||
|
|
||||||
#### 深圳大学研究生招生网通知公告
|
#### 深圳大学研究生招生网通知公告
|
||||||
|
|||||||
@@ -2622,6 +2622,14 @@ router.get('/xposed/module/:mod', require('./routes/xposed/module'));
|
|||||||
// Microsoft Edge
|
// Microsoft Edge
|
||||||
router.get('/edge/addon/:crxid', require('./routes/edge/addon'));
|
router.get('/edge/addon/:crxid', require('./routes/edge/addon'));
|
||||||
|
|
||||||
|
// 上海立信会计金融学院
|
||||||
|
router.get('/slu/tzgg/:id', require('./routes/universities/slu/tzgg'));
|
||||||
|
router.get('/slu/jwc/:id', require('./routes/universities/slu/jwc'));
|
||||||
|
router.get('/slu/tyyjkxy/:id', require('./routes/universities/slu/tyyjkxy'));
|
||||||
|
router.get('/slu/kjxy/:id', require('./routes/universities/slu/kjxy'));
|
||||||
|
router.get('/slu/xsc/:id', require('./routes/universities/slu/xsc'));
|
||||||
|
router.get('/slu/csggxy/:id', require('./routes/universities/slu/csggxy'));
|
||||||
|
|
||||||
// Ruby China
|
// Ruby China
|
||||||
router.get('/ruby-china/topics/:type?', require('./routes/ruby-china/topics'));
|
router.get('/ruby-china/topics/:type?', require('./routes/ruby-china/topics'));
|
||||||
router.get('/ruby-china/jobs', require('./routes/ruby-china/jobs'));
|
router.get('/ruby-china/jobs', require('./routes/ruby-china/jobs'));
|
||||||
|
|||||||
13
lib/routes/universities/slu/csggxy.js
Normal file
13
lib/routes/universities/slu/csggxy.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://csggxy.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > div.details > div.contentright > div.rightlist > ul > li');
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 财税与公共管理学院 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 财税与公共管理学院 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > div.neirong > div.rong', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
13
lib/routes/universities/slu/jwc.js
Normal file
13
lib/routes/universities/slu/jwc.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://jwc.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > div.details > div.contentright > div.rightlist > ul > li');
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 教务处 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 教务处 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > div.neirong > div.rong', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
14
lib/routes/universities/slu/kjxy.js
Normal file
14
lib/routes/universities/slu/kjxy.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://kjxy.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > div.erji > div.erjiright > div.rightlist > ul > li');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 会计学院 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 会计学院 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > div.wrapper > div.ContentPage > div.words > div.text', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
14
lib/routes/universities/slu/tyyjkxy.js
Normal file
14
lib/routes/universities/slu/tyyjkxy.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://tiyu.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > div.erji > div.erjiright > div.rightlist > ul > li');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 体育与健康学院 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 体育与健康学院 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > div.wrapper > div.ContentPage > div.words > div.text', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
14
lib/routes/universities/slu/tzgg.js
Normal file
14
lib/routes/universities/slu/tzgg.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://www.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > table > tbody > tr > td:nth-child(2) > div.xjr_list > ul > li');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 官网 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 官网 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > table > tbody > tr > td:nth-child(2) > div.xjr_content', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
68
lib/routes/universities/slu/utils.js
Normal file
68
lib/routes/universities/slu/utils.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
const dayjs = require('dayjs');
|
||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
fetchMain: async (url, dataElement) => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
// 获取列表
|
||||||
|
return {
|
||||||
|
list: $(dataElement)
|
||||||
|
.map((i, e) => ({
|
||||||
|
href: $(e).children('a').attr('href'),
|
||||||
|
publish_date: $(e).children('span').text(),
|
||||||
|
}))
|
||||||
|
.get(),
|
||||||
|
title: $('title').text(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fetchDetail: async (list, baseUrl, contentElement, cache) =>
|
||||||
|
// 定义输出的item
|
||||||
|
Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
let { href } = item;
|
||||||
|
const { publish_date } = item;
|
||||||
|
if (href.indexOf('http') !== 0) {
|
||||||
|
href = baseUrl + href;
|
||||||
|
}
|
||||||
|
const site_cache = await cache.get(href); // 得到全局中的缓存信息
|
||||||
|
// 判断缓存是否存在,如果存在即跳过此次获取的信息
|
||||||
|
|
||||||
|
if (site_cache) {
|
||||||
|
return Promise.resolve(JSON.parse(site_cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取详情页面的介绍
|
||||||
|
const detail_response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: href,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(detail_response.data);
|
||||||
|
const title = $('title').text();
|
||||||
|
let detail_content = $(contentElement).html();
|
||||||
|
|
||||||
|
if (!detail_content) {
|
||||||
|
// Unable to extract content
|
||||||
|
// this might be caused by external website referenced
|
||||||
|
// or this is a file
|
||||||
|
detail_content = `无法解析公告, 这可能是因为这是一个外部链接或者文件. 请<a href="${href}">点击查看</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置 RSS feed item
|
||||||
|
const single = {
|
||||||
|
title: title,
|
||||||
|
link: href,
|
||||||
|
description: detail_content,
|
||||||
|
pubDate: dayjs(`${publish_date} +0800`, 'YYYY-MM-DD ZZ'),
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置缓存
|
||||||
|
cache.set(href, JSON.stringify(single));
|
||||||
|
return Promise.resolve(single);
|
||||||
|
})
|
||||||
|
),
|
||||||
|
};
|
||||||
14
lib/routes/universities/slu/xsc.js
Normal file
14
lib/routes/universities/slu/xsc.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const utils = require('./utils');
|
||||||
|
const baseurl = 'http://xsc.lixin.edu.cn';
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const link = baseurl + `/info/iList.jsp?cat_id=${ctx.params.id}`;
|
||||||
|
const { list, title } = await utils.fetchMain(link, 'body > div.details > div.contentright > div.rightlist > ul > li');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${title} - 学生处 - 上海立信会计金融学院`,
|
||||||
|
link,
|
||||||
|
description: `${title} - 学生处 - 上海立信会计金融学院`,
|
||||||
|
item: await utils.fetchDetail(list, baseurl, 'body > div.neirong > div.rong', ctx.cache),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user