mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-08-31 01:01:11 +08:00
fix(route): update zju/grs (#9551)
* update zju/grs in university * refactor: migrate to v2 * fix: add radar * fix: not working routes * fix: add migration note * docs: remove N/A types from physics table * fix(radar): migrate old rules
This commit is contained in:
@@ -512,21 +512,6 @@
|
||||
],
|
||||
grs: [{ title: '研究生院通知', docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', source: '/*', target: '' }],
|
||||
},
|
||||
'zju.edu.cn': {
|
||||
_name: '浙江大学',
|
||||
cst: [
|
||||
{ title: '软件学院 - 全部通知', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: ['', '/*tpath'], target: '/zju/cst/0' },
|
||||
{ title: '软件学院 - 招生信息', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/32178/list.htm', target: '/zju/cst/1' },
|
||||
{ title: '软件学院 - 教务管理', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36216/list.htm', target: '/zju/cst/2' },
|
||||
{ title: '软件学院 - 论文管理', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36217/list.htm', target: '/zju/cst/3' },
|
||||
{ title: '软件学院 - 思政工作', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36192/list.htm', target: '/zju/cst/4' },
|
||||
{ title: '软件学院 - 评奖评优', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36228/list.htm', target: '/zju/cst/5' },
|
||||
{ title: '软件学院 - 实习就业', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36193/list.htm', target: '/zju/cst/6' },
|
||||
{ title: '软件学院 - 国际实习', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36235/list.htm', target: '/zju/cst/7' },
|
||||
{ title: '软件学院 - 国内合作科研', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36194/list.htm', target: '/zju/cst/8' },
|
||||
{ title: '软件学院 - 国际合作科研', docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', source: '/36246/list.htm', target: '/zju/cst/9' },
|
||||
],
|
||||
},
|
||||
'kuaidi100.com': {
|
||||
_name: '快递100',
|
||||
'.': [
|
||||
|
||||
+11
-11
@@ -2747,11 +2747,11 @@ type 列表:
|
||||
|
||||
### 普通栏目 如学术 / 图片 / 新闻等
|
||||
|
||||
<Route author="Jeason0228" example="/zju/list/xs" path="/zju/list/:type" :paramsDesc="['xs为学术,xw为新闻,5461是图片新闻,578是浙大报道,具体参数参考左侧的菜单']"/>
|
||||
<Route author="Jeason0228" example="/zju/list/xs" path="/zju/list/:type" :paramsDesc="['`xs`为学术,`xw`为新闻,`5461`是图片新闻,`578`是浙大报道,具体参数参考左侧的菜单']"/>
|
||||
|
||||
### 浙大研究生院
|
||||
### 研究生院
|
||||
|
||||
<Route author="Caicailiushui" example="/zju/grs/1" path="/zju/grs/:type" :paramsDesc="['1 为 全部公告,2 为教学管理,3 为各类资助,4 为学科建设,5 为海外交流']">
|
||||
<Route author="Caicailiushui" example="/zju/grs/1" path="/zju/grs/:type" :paramsDesc="['分类,见下表']">
|
||||
|
||||
| 全部公告 | 教学管理 | 各类资助 | 学科建设 | 海外交流 |
|
||||
| ---- | ---- | ---- | ---- | ---- |
|
||||
@@ -2759,9 +2759,9 @@ type 列表:
|
||||
|
||||
</Route>
|
||||
|
||||
### 浙大就业服务平台
|
||||
### 就业服务平台
|
||||
|
||||
<Route author="Caicailiushui" example="/zju/career/1" path="/zju/career/:type" :paramsDesc="['1 为新闻动态,2 为活动通知,3 为学院通知,4 为告示通知 ']">
|
||||
<Route author="Caicailiushui" example="/zju/career/1" path="/zju/career/:type" :paramsDesc="['分类,见下表']">
|
||||
|
||||
| 新闻动态 | 活动通知 | 学院通知 | 告示通知 |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
@@ -2769,17 +2769,17 @@ type 列表:
|
||||
|
||||
</Route>
|
||||
|
||||
### 浙大物理系
|
||||
### 物理学院
|
||||
|
||||
<Route author="Caicailiushui" example="/zju/physics/1" path="/zju/physics/:type" :paramsDesc="['1 为本系动态,2 为科研通知,3 为研究生教育最新消息,4 为学生思政最新消息,5 为研究生思政消息公告,6 为研究生奖助学金,7 为研究生思政就业信息,8 为本科生思政消息公告,9 为本科生奖助学金,10 为本科生就业信息,11 为学术报告']">
|
||||
<Route author="Caicailiushui" example="/zju/physics/1" path="/zju/physics/:type" :paramsDesc="['分类,见下表']">
|
||||
|
||||
| 本系动态 | 科研通知 | 研究生教育最新消息 | 学生思政最新消息 | 研究生思政消息公告 | 研究生奖助学金 | 研究生思政就业信息 | 本科生思政消息公告 | 本科生奖助学金 | 本科生就业信息 | 学术报告 |
|
||||
| ---- | ---- | --------- | -------- | --------- | ------- | --------- | --------- | ------- | ------- | ---- |
|
||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|
||||
| 本院动态 | 科研进展 | 研究生教育最新消息 |
|
||||
| ---- | ---- | --------- |
|
||||
| 1 | 2 | 3 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 浙大软件学院
|
||||
### 软件学院
|
||||
|
||||
<Route author="yonvenne zwithz" example="/zju/cst/0" path="/zju/cst/:type" :paramsDesc="['分类,见下表']" radar="1" rssbud="1">
|
||||
|
||||
|
||||
@@ -1238,71 +1238,6 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'zju.edu.cn': {
|
||||
_name: '浙江大学',
|
||||
cst: [
|
||||
{
|
||||
title: '软件学院 - 全部通知',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['', '/*tpath'],
|
||||
target: '/zju/cst/0',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 招生信息',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/32178/list.htm',
|
||||
target: '/zju/cst/1',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 教务管理',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36216/list.htm',
|
||||
target: '/zju/cst/2',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 论文管理',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36217/list.htm',
|
||||
target: '/zju/cst/3',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 思政工作',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36192/list.htm',
|
||||
target: '/zju/cst/4',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 评奖评优',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36228/list.htm',
|
||||
target: '/zju/cst/5',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 实习就业',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36193/list.htm',
|
||||
target: '/zju/cst/6',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国际实习',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36235/list.htm',
|
||||
target: '/zju/cst/7',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国内合作科研',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36194/list.htm',
|
||||
target: '/zju/cst/8',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国际合作科研',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36246/list.htm',
|
||||
target: '/zju/cst/9',
|
||||
},
|
||||
],
|
||||
},
|
||||
'kuaidi100.com': {
|
||||
_name: '快递100',
|
||||
'.': [
|
||||
|
||||
+7
-7
@@ -1470,13 +1470,13 @@ router.get('/psnine/game', lazyloadRouteHandler('./routes/psnine/game'));
|
||||
router.get('/psnine/news/:order?', lazyloadRouteHandler('./routes/psnine/news'));
|
||||
router.get('/psnine/node/:id?/:order?', lazyloadRouteHandler('./routes/psnine/node'));
|
||||
|
||||
// 浙江大学
|
||||
router.get('/zju/list/:type', lazyloadRouteHandler('./routes/universities/zju/list'));
|
||||
router.get('/zju/physics/:type', lazyloadRouteHandler('./routes/universities/zju/physics'));
|
||||
router.get('/zju/grs/:type', lazyloadRouteHandler('./routes/universities/zju/grs'));
|
||||
router.get('/zju/career/:type', lazyloadRouteHandler('./routes/universities/zju/career'));
|
||||
router.get('/zju/cst/:type', lazyloadRouteHandler('./routes/universities/zju/cst'));
|
||||
router.get('/zju/cst/custom/:id', lazyloadRouteHandler('./routes/universities/zju/cst/custom'));
|
||||
// 浙江大学 migrated to v2
|
||||
// router.get('/zju/list/:type', lazyloadRouteHandler('./routes/universities/zju/list'));
|
||||
// router.get('/zju/physics/:type', lazyloadRouteHandler('./routes/universities/zju/physics'));
|
||||
// router.get('/zju/grs/:type', lazyloadRouteHandler('./routes/universities/zju/grs'));
|
||||
// router.get('/zju/career/:type', lazyloadRouteHandler('./routes/universities/zju/career'));
|
||||
// router.get('/zju/cst/:type', lazyloadRouteHandler('./routes/universities/zju/cst'));
|
||||
// router.get('/zju/cst/custom/:id', lazyloadRouteHandler('./routes/universities/zju/cst/custom'));
|
||||
|
||||
// 浙江大学城市学院
|
||||
router.get('/zucc/news/latest', lazyloadRouteHandler('./routes/universities/zucc/news'));
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
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 got({
|
||||
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,
|
||||
};
|
||||
};
|
||||
@@ -1,78 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const host = 'http://www.zju.edu.cn/';
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || 'xs';
|
||||
const link = host + type + `/list.htm`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
function sortDate(e) {
|
||||
// console.log(e);
|
||||
const pubday = e.substr(-3, 2);
|
||||
const pubmonth = e.substr(-6, 2);
|
||||
const pubyear = e.substr(-11, 4);
|
||||
const pubdateString = pubmonth + `-` + pubday + `-` + pubyear;
|
||||
// console.log(pubdateString);
|
||||
|
||||
return pubdateString;
|
||||
}
|
||||
function sortUrl(e) {
|
||||
if (e.search('redirect') !== -1) {
|
||||
return link;
|
||||
} else {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
const list = $('#wp_news_w7 ul.news li')
|
||||
.map(function () {
|
||||
const info = {
|
||||
title: $(this).find('a').text(),
|
||||
link: sortUrl($(this).find('a').attr('href')),
|
||||
date: sortDate($(this).text()),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
const out = await Promise.all(
|
||||
list.map(async (info) => {
|
||||
const title = info.title;
|
||||
const date = info.date;
|
||||
const itemUrl = url.resolve(host, info.link);
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('.right_content').html();
|
||||
const single = {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: new Date(date).toLocaleDateString(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `浙江大学` + $('ul.submenu .selected').text(),
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const host = 'http://physics.zju.edu.cn/redir.php?catalog_id=';
|
||||
// const host = 'http://10.14.122.238/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' }],
|
||||
[11, { title: '浙大物理系 -- 学术报告', id: '3735' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const id = map.get(type).id;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: `${host}${id}`,
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
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')}`,
|
||||
// link: `http://10.14.122.238/${item.find('a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: map.get(type).title,
|
||||
link: `${host}${id}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,35 +1,36 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const rootUrl = 'http://www.career.zju.edu.cn';
|
||||
const host = 'http://www.career.zju.edu.cn/jyxt/jygz/new/getContent.zf?minCount=0&maxCount=10&';
|
||||
|
||||
const map = new Map([
|
||||
[1, { title: '浙大就业服务平台 -- 新闻动态', id: 'lmjdid=739BEBB72A072B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=670' }],
|
||||
[2, { title: '浙大就业服务平台 -- 活动通知', id: 'lmjdid=739BEBB72A0B2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=1196' }],
|
||||
[3, { title: '浙大就业服务平台 -- 学院动态', id: 'lmjdid=739BEBB72A0C2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=8' }],
|
||||
[4, { title: '浙大就业服务平台 -- 告示通告', id: 'lmjdid=739BEBB72A252B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2&_=15' }],
|
||||
[1, { title: '浙大就业服务平台 -- 新闻动态', id: 'lmjdid=739BEBB72A072B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2' }],
|
||||
[2, { title: '浙大就业服务平台 -- 活动通知', id: 'lmjdid=739BEBB72A0B2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2' }],
|
||||
[3, { title: '浙大就业服务平台 -- 学院动态', id: 'lmjdid=739BEBB72A0C2B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2' }],
|
||||
[4, { title: '浙大就业服务平台 -- 告示通告', id: 'lmjdid=739BEBB72A252B25E0538713470A6C41&sjlmid=undefined&lmtype=2&lx=2' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const type = parseInt(ctx.params.type);
|
||||
const id = map.get(type).id;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: `${host}${id}`,
|
||||
});
|
||||
const res = await got(`${host}${id}`);
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('.com-list').find('li').slice(0, 10);
|
||||
const list = $('.com-list li');
|
||||
const items =
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const link = item.find('a').eq(0);
|
||||
return {
|
||||
// title: item.find('a').attr('title'),
|
||||
title: item.find('.news-ctn').text(),
|
||||
pubDate: new Date(item.find('.new-time').text()).toUTCString(),
|
||||
title: item.find('span').eq(0).attr('title'),
|
||||
pubDate: parseDate(item.find('.news-time').text()),
|
||||
|
||||
link: `www.career.zju.edu.cn${item.find('a').eq(0).attr('href')}`,
|
||||
link: link.attr('href').startsWith('http') ? link.attr('href') : `${rootUrl}/jyxt${link.attr('data-src')}xwid=${link.attr('data-xwid')}&lmtype=${link.attr('data-lmtype')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
@@ -1,5 +1,6 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
async function getPage(id) {
|
||||
const res = await got({
|
||||
@@ -16,7 +17,7 @@ async function getPage(id) {
|
||||
item = $(item);
|
||||
|
||||
const title = item.find('a').text();
|
||||
const pubDate = new Date(item.find('.fr').text()).toUTCString();
|
||||
const pubDate = parseDate(item.find('.fr').text());
|
||||
const link = item.find('a').attr('href');
|
||||
|
||||
return {
|
||||
@@ -1,5 +1,6 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const host = 'http://www.cst.zju.edu.cn/';
|
||||
|
||||
@@ -33,7 +34,7 @@ async function getPage(id) {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
pubDate: new Date(item.find('.fr').text()).toUTCString(),
|
||||
pubDate: parseDate(item.find('.fr').text()),
|
||||
link: item.find('a').attr('href'),
|
||||
};
|
||||
})
|
||||
@@ -42,7 +43,7 @@ async function getPage(id) {
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = Number.parseInt(ctx.params.type);
|
||||
const type = parseInt(ctx.params.type);
|
||||
const link = host + map.get(type).id;
|
||||
let items = [];
|
||||
if (type === 0) {
|
||||
@@ -59,30 +60,25 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
|
||||
const out = await Promise.all(
|
||||
items.map(async (item) => {
|
||||
items.map((item) => {
|
||||
const itemUrl = host + item.link;
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('.vid_wz').html();
|
||||
return {
|
||||
title: item.title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: item.pubDate,
|
||||
};
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('.vid_wz').html();
|
||||
const single = {
|
||||
title: item.title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: item.pubDate,
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const host = 'http://www.grs.zju.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
[1, { title: '浙大研究生院 -- 全部公告', tag: '1335' }],
|
||||
[2, { title: '浙大研究生院 -- 教学管理', tag: '1336' }],
|
||||
[3, { title: '浙大研究生院 -- 各类资助', tag: '1337' }],
|
||||
[4, { title: '浙大研究生院 -- 学科建设', tag: '1338' }],
|
||||
[5, { title: '浙大研究生院 -- 海外交流', tag: '1339' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = parseInt(ctx.params.type);
|
||||
const tag = map.get(type).tag;
|
||||
const url = `${host}${tag}/list.htm`;
|
||||
const res = await got(url);
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('#wp_news_w24').find('.list_nav');
|
||||
|
||||
const items =
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.list_tit').children('a').attr('title'),
|
||||
pubDate: parseDate(item.find('.list_time').text()),
|
||||
link: `http://www.grs.zju.edu.cn/${item.find('a').eq(-1).attr('href')}`,
|
||||
description: item.find('.list_intro a').text(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: map.get(type).title,
|
||||
link: `${host}${tag}/list.htm`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const host = 'https://www.zju.edu.cn/';
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? 'xs';
|
||||
const link = host + type + `/list.htm`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
function sortUrl(e) {
|
||||
if (e.search('redirect') !== -1) {
|
||||
return link;
|
||||
} else {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
const list = $('#wp_news_w7 ul.news li')
|
||||
.map(function () {
|
||||
const info = {
|
||||
title: $(this).find('a').attr('title'),
|
||||
link: sortUrl($(this).find('a').attr('href')),
|
||||
date: $(this)
|
||||
.text()
|
||||
.match(/\d{4}-\d{2}-\d{2}/)[0],
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map((info) => {
|
||||
const title = info.title;
|
||||
const date = info.date;
|
||||
const itemUrl = new URL(info.link, host).href;
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
headers: {
|
||||
Referer: link,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('.right_content').html();
|
||||
return {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: parseDate(date),
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `浙江大学` + $('ul.submenu .selected').text(),
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
'/career/:type': ['Caicailiushui'],
|
||||
'/cst/custom/:id': ['zwithz'],
|
||||
'/cst/:type': ['yonvenne', 'zwithz'],
|
||||
'/grs/:type': ['Caicailiushui'],
|
||||
'/list/:type': ['Jeason0228'],
|
||||
'/physics/:type': ['Caicailiushui'],
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
// const host = 'http://physics.zju.edu.cn/redir.php?catalog_id=';
|
||||
const host = 'http://physics.zju.edu.cn';
|
||||
// const host = 'http://10.14.122.238/redir.php?catalog_id=';
|
||||
|
||||
const map = new Map([
|
||||
[1, { title: '浙大物理学院 -- 本院动态', id: '39060' }],
|
||||
[2, { title: '浙大物理学院 -- 科研进展', id: '39070' }],
|
||||
[3, { title: '浙大物理学院 -- 研究生教育最新消息', id: '39079' }],
|
||||
|
||||
// could not find these sections due to http://physics.zju.edu.cn/2022/0325/c39060a2510676/page.htm
|
||||
/* [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' }],
|
||||
[11, { title: '浙大物理学院 -- 学术报告', id: '3735' }],*/
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = parseInt(ctx.params.type);
|
||||
const id = map.get(type).id;
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: `${host}/${id}/list.htm`,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
const items = $('#arthd li')
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('a').attr('title'),
|
||||
pubDate: parseDate(item.find('.art-date').text()),
|
||||
|
||||
link: `http://physics.zju.edu.cn/${item.find('a').attr('href')}`,
|
||||
// link: `http://10.14.122.238/${item.find('a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: map.get(type).title,
|
||||
link: `${host}${id}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,139 @@
|
||||
module.exports = {
|
||||
'zju.edu.cn': {
|
||||
_name: '浙江大学',
|
||||
physics: [
|
||||
{
|
||||
title: '物理学院',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['/*path'],
|
||||
target: (params) => {
|
||||
let type;
|
||||
switch (params.path) {
|
||||
case '39060/list.htm':
|
||||
type = '1';
|
||||
break;
|
||||
case '39070/list.htm':
|
||||
type = '2';
|
||||
break;
|
||||
case '39079/list.htm':
|
||||
type = '3';
|
||||
break;
|
||||
default:
|
||||
type = '1';
|
||||
break;
|
||||
}
|
||||
return `/zju/physics/${type}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
www: [
|
||||
{
|
||||
title: '普通栏目',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['/*path'],
|
||||
target: (params) => `/zju/list/${params.path.replace('/list.htm', '')}`,
|
||||
},
|
||||
],
|
||||
'www.career': [
|
||||
{
|
||||
title: '就业服务平台',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['/'],
|
||||
target: '/zju/career/1',
|
||||
},
|
||||
],
|
||||
'www.cst': [
|
||||
{
|
||||
title: '软件学院 - 全部通知',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['', '/*tpath'],
|
||||
target: '/zju/cst/0',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 招生信息',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/32178/list.htm',
|
||||
target: '/zju/cst/1',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 教务管理',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36216/list.htm',
|
||||
target: '/zju/cst/2',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 论文管理',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36217/list.htm',
|
||||
target: '/zju/cst/3',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 思政工作',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36192/list.htm',
|
||||
target: '/zju/cst/4',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 评奖评优',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36228/list.htm',
|
||||
target: '/zju/cst/5',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 实习就业',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36193/list.htm',
|
||||
target: '/zju/cst/6',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国际实习',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36235/list.htm',
|
||||
target: '/zju/cst/7',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国内合作科研',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36194/list.htm',
|
||||
target: '/zju/cst/8',
|
||||
},
|
||||
{
|
||||
title: '软件学院 - 国际合作科研',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: '/36246/list.htm',
|
||||
target: '/zju/cst/9',
|
||||
},
|
||||
],
|
||||
'www.grs': [
|
||||
{
|
||||
title: '研究生院',
|
||||
docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue',
|
||||
source: ['/*path', '/'],
|
||||
target: (params) => {
|
||||
let type;
|
||||
switch (params.path) {
|
||||
case '1335/list.htm':
|
||||
type = 1;
|
||||
break;
|
||||
case '1336/list.htm':
|
||||
type = 2;
|
||||
break;
|
||||
case '1337/list.htm':
|
||||
type = 3;
|
||||
break;
|
||||
case '1338/list.htm':
|
||||
type = 4;
|
||||
break;
|
||||
case '1339/list.htm':
|
||||
type = 5;
|
||||
break;
|
||||
default:
|
||||
type = 1;
|
||||
break;
|
||||
}
|
||||
return `/zju/grs/${type}`;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/career/:type', require('./career'));
|
||||
router.get('/cst/custom/:id', require('./cst/custom'));
|
||||
router.get('/cst/:type', require('./cst'));
|
||||
router.get('/grs/:type', require('./grs'));
|
||||
router.get('/list/:type', require('./list'));
|
||||
router.get('/physics/:type', require('./physics'));
|
||||
};
|
||||
Reference in New Issue
Block a user