add zju in universities (#1802)

添加了对浙江大学的 rss 支持。
This commit is contained in:
QIanGua
2019-03-22 23:47:48 +08:00
committed by DIYgod
parent a55406df34
commit f9b40b7494
5 changed files with 187 additions and 0 deletions

View File

@@ -2072,6 +2072,32 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
</route>
### 浙江大学
<route name="浙大研究生院" author="Caicailiushui" example="/zju/grs/1" path="/universities/zju/grs/:type" :paramsDesc="['1 为 全部公告, 2 为教学管理, 3 为各类资助4 为学科建设 5 为海外交流']">
| 全部公告 | 教学管理 | 各类资助 | 学科建设 | 海外交流 |
| -------- | -------- | -------- | -------- | -------- |
| 1 | 2 | 3 | 4 | 5 |
</route>
<route name="浙大就业服务平台" author="Caicailiushui" example="/zju/career/1" path="/universities/zju/career/:type" :paramsDesc="['1 为新闻动态, 2 为活动通知, 3 为学院通知4 为告示通知 ']">
| 新闻动态 | 活动通知 | 学院通知 | 告示通知 |
| -------- | -------- | -------- | -------- |
| 1 | 2 | 3 | 4 |
</route>
<route name="浙大物理系" author="Caicailiushui" example="/zju/physics/1" path="/universities/zju/physics/:type" :paramsDesc="['1 为本系动态, 2 为科研通知, 3 为研究生教育最新消息4 为学生思政最新消息5 为研究生思政消息公告6 为研究生奖助学金7 为研究生思政就业信息8 为本科生思政消息公告9 为本科生奖助学金10 为本科生就业信息 ']">
| 本系动态 | 科研通知 | 研究生教育最新消息 | 学生思政最新消息 | 研究生思政消息公告 | 研究生奖助学金 | 研究生思政就业信息 | 本科生思政消息公告 | 本科生奖助学金 | 本科生就业信息 |
| -------- | -------- | ------------------ | ---------------- | ------------------ | -------------- | ------------------ | ------------------ | -------------- | -------------- |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
</route>
## 传统媒体
### 央视新闻

View File

@@ -1192,4 +1192,9 @@ router.get('/gamersky/news', require('./routes/gamersky/news'));
// 游研社
router.get('/yystv/recommend/', require('./routes/yystv/recommend'));
// 浙江大学
router.get('/zju/physics/:type', require('./routes/universities/zju/physics'));
router.get('/zju/grs/:type', require('./routes/universities/zju/grs'));
router.get('/zju/career/:type', require('./routes/universities/zju/career'));
module.exports = router;

View File

@@ -0,0 +1,54 @@
const axios = require('../../../../utils/axios');
const cheerio = require('cheerio');
const host = 'http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&lmjdid=739BEBB72A072B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=';
const map = new Map([
[1, { title: '浙大就业服务平台 -- 新闻动态', id: '1553156316534' }],
[2, { title: '浙大就业服务平台 -- 活动通知', id: '1553156316535' }],
[3, { title: '浙大就业服务平台 -- 学院动态', id: '1553156316536' }],
[4, { title: '浙大就业服务平台 -- 告示通告', id: '1553156316537' }],
]);
// http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&lmjdid=739BEBB72A072B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=1553156316534
// http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&lmjdid=739BEBB72A0B2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=1553156316535
// http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&lmjdid=739BEBB72A0C2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=1553156316536
// http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&lmjdid=739BEBB72A252B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=1553156316537
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
const id = map.get(type).id;
const res = await axios({
method: 'get',
url: host + `${id}`,
});
const $ = cheerio.load(res.data);
const list = $('.com-list')
.find('li')
.slice(0, 10);
const items =
list &&
list
.map((index, item) => {
item = $(item);
return {
// title: item.find('a').attr('title'),
title: item.find('.news-ctn').text(),
pubDate: new Date(item.find('.new-time').text()).toUTCString(),
link: `www.career.zju.edu.cn/${item
.find('a')
.eq(0)
.attr('href')}`,
};
})
.get();
ctx.state.data = {
title: map.get(type).title,
link: host + `${id}`,
item: items,
};
};

View File

@@ -0,0 +1,49 @@
const axios = require('../../../../utils/axios');
const cheerio = require('cheerio');
const host = 'http://grs.zju.edu.cn/redir.php?catalog_id=16313';
const map = new Map([
[1, { title: '浙大研究生院 -- 全部公告', tag: '' }],
[2, { title: '浙大研究生院 -- 教学管理', tag: '&tag=%E6%95%99%E5%AD%A6%E7%AE%A1%E7%90%86' }],
[3, { title: '浙大研究生院 -- 各类资助', tag: '&tag=%E5%90%84%E7%B1%BB%E8%B5%84%E5%8A%A9' }],
[4, { title: '浙大研究生院 -- 学科建设', tag: '&tag=%E5%AD%A6%E7%A7%91%E5%BB%BA%E8%AE%BE' }],
[5, { title: '浙大研究生院 -- 海外交流', tag: '&tag=%E6%B5%B7%E5%A4%96%E4%BA%A4%E6%B5%81' }],
]);
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
const tag = map.get(type).tag;
const res = await axios({
method: 'get',
url: host + `${tag}`,
});
const $ = cheerio.load(res.data);
const list = $('.cg-pic-news-list')
.find('li')
.slice(0, 20);
const items =
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
pubDate: new Date(item.find('.art-dateee').text()).toUTCString(),
link: `http://grs.zju.edu.cn/${item
.find('a')
.eq(-1)
.attr('href')}`,
description: item.find('div').text(),
};
})
.get();
ctx.state.data = {
title: map.get(type).title,
link: host + `${tag}`,
item: items,
};
};

View File

@@ -0,0 +1,53 @@
const axios = require('../../../../utils/axios');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
const host = 'http://physics.zju.edu.cn/redir.php?catalog_id=';
const map = new Map([
[1, { title: '浙大物理系 -- 本系动态', id: '66' }],
[2, { title: '浙大物理系 -- 科研通知', id: '88' }],
[3, { title: '浙大物理系 -- 研究生教育最新消息', id: '104' }],
[4, { title: '浙大物理系 -- 学生思政最新消息', id: '112' }],
[5, { title: '浙大物理系 -- 研究生思政消息公告', id: '155' }],
[6, { title: '浙大物理系 -- 研究生奖助学金', id: '661' }],
[7, { title: '浙大物理系 -- 研究生思政就业信息', id: '664' }],
[8, { title: '浙大物理系 -- 本科生思政消息公告', id: '667' }],
[9, { title: '浙大物理系 -- 本科生奖助学金', id: '670' }],
[10, { title: '浙大物理系 -- 本科生就业信息', id: '671' }],
]);
module.exports = async (ctx) => {
const type = Number.parseInt(ctx.params.type);
const id = map.get(type).id;
const res = await axios({
method: 'get',
url: host + `${id}`,
responseType: 'arraybuffer',
});
const $ = cheerio.load(iconv.decode(res.data, 'gb2312'));
const list = $('.art_list')
.find('li')
.slice(0, 20);
const items =
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').text(),
// title: item.find('a').attr('title'),
pubDate: new Date(item.find('.date').text()).toUTCString(),
link: `http://physics.zju.edu.cn/${item.find('a').attr('href')}`,
};
})
.get();
ctx.state.data = {
title: map.get(type).title,
link: host + `${id}`,
item: items,
};
};