mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 22:19:40 +08:00
@@ -2044,6 +2044,16 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
|
|||||||
|
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
### 浙江工商大学
|
||||||
|
|
||||||
|
<route name="浙江工商大学" author="nicolaszf" example="/zjgsu/tzgg" path="/zjgsu/:type" :paramsDesc="['分类, 见下表']">
|
||||||
|
|
||||||
|
| 通知公告 | 学生专区 | 公示公告 |
|
||||||
|
| -------- | -------- | -------- |
|
||||||
|
| tzgg | xszq | gsgg |
|
||||||
|
|
||||||
|
</route>
|
||||||
|
|
||||||
## 传统媒体
|
## 传统媒体
|
||||||
|
|
||||||
### 央视新闻
|
### 央视新闻
|
||||||
|
|||||||
@@ -1163,4 +1163,9 @@ router.get('/vgtime/release', require('./routes/vgtime/release'));
|
|||||||
// MP4吧
|
// MP4吧
|
||||||
router.get('/mp4ba/:param', require('./routes/mp4ba'));
|
router.get('/mp4ba/:param', require('./routes/mp4ba'));
|
||||||
|
|
||||||
|
// 浙江工商大学
|
||||||
|
router.get('/zjgsu/tzgg', require('./routes/universities/zjgsu/tzgg/scripts'));
|
||||||
|
router.get('/zjgsu/gsgg', require('./routes/universities/zjgsu/gsgg/scripts'));
|
||||||
|
router.get('/zjgsu/xszq', require('./routes/universities/zjgsu/xszq/scripts'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
42
lib/routes/universities/zjgsu/gsgg/scripts.js
Normal file
42
lib/routes/universities/zjgsu/gsgg/scripts.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
const axios = require('../../../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const res = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=83',
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
});
|
||||||
|
res.data = iconv.decode(res.data, 'gb2312');
|
||||||
|
const $ = cheerio.load(res.data);
|
||||||
|
const list = $('table')
|
||||||
|
.eq(19)
|
||||||
|
.find('tr');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '浙江工商大学教务处-公示公告',
|
||||||
|
link: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=83',
|
||||||
|
description: '浙江工商大学教务处-公示公告',
|
||||||
|
item:
|
||||||
|
list &&
|
||||||
|
list
|
||||||
|
.map((index, item) => {
|
||||||
|
item = $(item);
|
||||||
|
const date = new Date(
|
||||||
|
item
|
||||||
|
.find('td')
|
||||||
|
.eq(2)
|
||||||
|
.text()
|
||||||
|
);
|
||||||
|
const serverOffset = date.getTimezoneOffset() / 60;
|
||||||
|
return {
|
||||||
|
title: item.find('a').text(),
|
||||||
|
description: item.find('a').text(),
|
||||||
|
link: `http://jww.zjgsu.edu.cn/${item.find('a').attr('href')}`,
|
||||||
|
pubDate: new Date(date.getTime() - 60 * 60 * 1000 * serverOffset).toUTCString(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
23
lib/routes/universities/zjgsu/tzgg/scripts.js
Normal file
23
lib/routes/universities/zjgsu/tzgg/scripts.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const axios = require('../../../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const util = require('./utils');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://news.zjgsu.edu.cn/18/',
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('ul.list-1 li').get();
|
||||||
|
|
||||||
|
const result = await util.ProcessFeed(list, ctx.cache);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '浙江工商大学新闻网-通知公告',
|
||||||
|
link: 'http://news.zjgsu.edu.cn/18/',
|
||||||
|
description: '浙江工商大学新闻网-通知公告',
|
||||||
|
item: result,
|
||||||
|
};
|
||||||
|
};
|
||||||
54
lib/routes/universities/zjgsu/tzgg/utils.js
Normal file
54
lib/routes/universities/zjgsu/tzgg/utils.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
const axios = require('../../../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
|
// 加载文章页
|
||||||
|
async function load(link) {
|
||||||
|
const response = await axios.get(link);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const date = new Date(
|
||||||
|
$('p')
|
||||||
|
.text()
|
||||||
|
.match(/\d{4}-\d{2}-\d{2}/)
|
||||||
|
);
|
||||||
|
|
||||||
|
const pubDate = new Date(date.getTime()).toUTCString();
|
||||||
|
|
||||||
|
// 提取内容
|
||||||
|
const description = $('dd').html();
|
||||||
|
|
||||||
|
return { description, pubDate };
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProcessFeed = async (list, caches) => {
|
||||||
|
const host = 'http://news.zjgsu.edu.cn';
|
||||||
|
|
||||||
|
return await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
const $ = cheerio.load(item);
|
||||||
|
|
||||||
|
const $title = $('a');
|
||||||
|
// 还原相对链接为绝对链接
|
||||||
|
const itemUrl = url.resolve(host, $title.attr('href'));
|
||||||
|
|
||||||
|
// 列表上提取到的信息
|
||||||
|
const single = {
|
||||||
|
title: $title.text(),
|
||||||
|
link: itemUrl,
|
||||||
|
guid: itemUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 使用tryGet方法从缓存获取内容。
|
||||||
|
// 当缓存中无法获取到链接内容的时候,则使用load方法加载文章内容。
|
||||||
|
const other = await caches.tryGet(itemUrl, async () => await load(itemUrl));
|
||||||
|
|
||||||
|
// 合并解析后的结果集作为该篇文章最终的输出结果
|
||||||
|
return Promise.resolve(Object.assign({}, single, other));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ProcessFeed,
|
||||||
|
};
|
||||||
42
lib/routes/universities/zjgsu/xszq/scripts.js
Normal file
42
lib/routes/universities/zjgsu/xszq/scripts.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
const axios = require('../../../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const res = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=6',
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
});
|
||||||
|
res.data = iconv.decode(res.data, 'gb2312');
|
||||||
|
const $ = cheerio.load(res.data);
|
||||||
|
const list = $('table')
|
||||||
|
.eq(20)
|
||||||
|
.find('tr');
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '浙江工商大学教务处-学生专区',
|
||||||
|
link: 'http://jww.zjgsu.edu.cn/ArticleList.asp?nid=6',
|
||||||
|
description: '浙江工商大学教务处-学生专区',
|
||||||
|
item:
|
||||||
|
list &&
|
||||||
|
list
|
||||||
|
.map((index, item) => {
|
||||||
|
item = $(item);
|
||||||
|
const date = new Date(
|
||||||
|
item
|
||||||
|
.find('td')
|
||||||
|
.eq(2)
|
||||||
|
.text()
|
||||||
|
);
|
||||||
|
const serverOffset = date.getTimezoneOffset() / 60;
|
||||||
|
return {
|
||||||
|
title: item.find('a').text(),
|
||||||
|
description: item.find('a').text(),
|
||||||
|
link: `http://jww.zjgsu.edu.cn/${item.find('a').attr('href')}`,
|
||||||
|
pubDate: new Date(date.getTime() - 60 * 60 * 1000 * serverOffset).toUTCString(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user