mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
fix(route): 南京航空航天大学相关路由 (#10646)
This commit is contained in:
+20
-12
@@ -1811,7 +1811,7 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
### 教务处
|
||||
|
||||
<Route author="arcosx Seiry qrzbing" example="/nuaa/jwc/tzgg" path="/nuaa/jwc/:type/:getDescription?" :paramsDesc="['分类名', '是否获取描述']" puppeteer="1">
|
||||
<Route author="arcosx Seiry qrzbing Xm798" example="/nuaa/jwc/tzgg" path="/nuaa/jwc/:type/:getDescription?" :paramsDesc="['分类名', '是否获取全文']" puppeteer="1">
|
||||
|
||||
| 通知公告 | 教学服务 | 教学建设 | 学生培养 | 教学资源 |
|
||||
| ---- | ---- | ---- | ---- | ---- |
|
||||
@@ -1819,9 +1819,27 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
</Route>
|
||||
|
||||
### 研究生院
|
||||
|
||||
<Route author="junfengP Seiry Xm798" example="/nuaa/yjsy/tzgg" path="/nuaa/yjsy/:getDescription?" :paramsDesc="['分类名', '是否获取全文']" puppeteer="1">
|
||||
|
||||
| 通知公告 | 新闻动态 | 学术信息 | 师生风采 |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| tzgg | xwdt | xsxx | ssfc |
|
||||
|
||||
</Route>
|
||||
|
||||
### 自动化学院
|
||||
|
||||
<Route author="Seiry qrzbing Xm798" example="/nuaa/cae/zhxw" path="/nuaa/cs/:type/:getDescription?" :paramsDesc="['分类名', '是否获取全文']" puppeteer="1">
|
||||
|
||||
| 综合新闻 | 党委行政 | 人事 / 合作 | 研究生培养 | 本科生培养 | 学生工作 | 通知公告 | 学术信息 | 答辩公告 |
|
||||
| ---- | ---- | ------- | ----- | ----- | ---- | ---- | ---- | ---- |
|
||||
| zhxw | dwxz | rshz | yjs | bks | xsgz | tzgg | xsxx | dbgg |
|
||||
|
||||
### 计算机科学与技术学院
|
||||
|
||||
<Route author="LogicJake Seiry qrzbing" example="/nuaa/cs/jxdt" path="/nuaa/cs/:type/:getDescription?" :paramsDesc="['分类名', '是否获取描述']" puppeteer="1">
|
||||
<Route author="LogicJake Seiry qrzbing Xm798" example="/nuaa/cs/jxdt" path="/nuaa/cs/:type/:getDescription?" :paramsDesc="['分类名', '是否获取全文']" puppeteer="1">
|
||||
|
||||
| 通知公告 | 热点新闻 | 学科科研 | 教学动态 | 本科生培养 | 研究生培养 | 学生工作 |
|
||||
| ---- | ---- | ---- | ---- | ----- | ----- | ---- |
|
||||
@@ -1829,16 +1847,6 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
</Route>
|
||||
|
||||
### 研究生院
|
||||
|
||||
<Route author="junfengP Seiry" example="/nuaa/yjsy/latest" path="/nuaa/yjsy/:type?" :paramsDesc="['分类名']"/>
|
||||
|
||||
| 最近动态 | 研院新闻 | 上级文件 | 管理文件 | 信息服务 |
|
||||
| ------ | ---- | ---- | ---- | ---- |
|
||||
| latest | yyxw | sjwj | glwj | xxfw |
|
||||
|
||||
</Route>
|
||||
|
||||
## 南京理工大学
|
||||
|
||||
### 教务处
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
const host = 'https://cae.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
['zhxw', { title: '综合新闻 | 南京航空航天大学自动化学院', suffix: '5399/list.htm' }],
|
||||
['dwxz', { title: '党委行政 | 南京航空航天大学自动化学院', suffix: '13266/list.htm' }],
|
||||
['rshz', { title: '人事/合作 | 南京航空航天大学自动化学院', suffix: '13267/list.htm' }],
|
||||
['yjs', { title: '研究生培养 | 南京航空航天大学自动化学院', suffix: '13271/list.htm' }],
|
||||
['bks', { title: '本科生培养 | 南京航空航天大学自动化学院', suffix: '13270/list.htm' }],
|
||||
['xsgz', { title: '学生工作 | 南京航空航天大学自动化学院', suffix: '13268/list.htm' }],
|
||||
['tzgg', { title: '通知公告 | 南京航空航天大学自动化学院', suffix: '13264/list.htm' }],
|
||||
['xsxx', { title: '学术信息 | 南京航空航天大学自动化学院', suffix: '13265/list.htm' }],
|
||||
['dbgg', { title: '答辩公告 | 南京航空航天大学自动化学院', suffix: 'dbgg/list.htm' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const suffix = map.get(type).suffix;
|
||||
const getDescription = Boolean(ctx.params.getDescription) || false;
|
||||
const link = new URL(suffix, host).href;
|
||||
const cookie = await getCookie(host);
|
||||
const gotConfig = {
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
};
|
||||
const response = await got(link, gotConfig);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('#wp_news_w6 ul li')
|
||||
.slice(0, 10)
|
||||
.map(function () {
|
||||
const info = {
|
||||
title: $(this).find('a').text(),
|
||||
link: $(this).find('a').attr('href'),
|
||||
date: $(this).find('span').text(),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map((info) => {
|
||||
const title = info.title || 'zhxw';
|
||||
const date = info.date;
|
||||
const itemUrl = new URL(info.link, host).href;
|
||||
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const arr = itemUrl.split('.');
|
||||
const pageType = arr[arr.length - 1];
|
||||
|
||||
// 南航新 WAF 过于敏感
|
||||
// 目前 description 需要遍历页面,会被 WAF 拦截导致无法输出
|
||||
// 考虑换一种获取 description 的方式或者将标题当作 title。
|
||||
let description = title + '<br><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
if (getDescription) {
|
||||
description = itemUrl;
|
||||
if (pageType === 'htm' || pageType === 'html') {
|
||||
const response = await got(itemUrl, gotConfig);
|
||||
const $ = cheerio.load(response.data);
|
||||
description = $('.wp_articlecontent').html() + '<br><hr /><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
}
|
||||
}
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: parseDate(date),
|
||||
};
|
||||
return single;
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: map.get(type).title,
|
||||
link,
|
||||
description: '南京航空航天大学自动化学院RSS',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -2,16 +2,16 @@ const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
const host = 'http://cs.nuaa.edu.cn/';
|
||||
const host = 'https://cs.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
['tzgg', { title: '南京航空航天大学计算机科学与技术学院 -- 通知公告', suffix: 'tzgg/list.htm' }],
|
||||
['rdxw', { title: '南京航空航天大学计算机科学与技术学院 -- 热点新闻', suffix: '10846/list.htm' }],
|
||||
['xkky', { title: '南京航空航天大学计算机科学与技术学院 -- 学科科研', suffix: '10849/list.htm' }],
|
||||
['be', { title: '南京航空航天大学计算机科学与技术学院 -- 本科生培养', suffix: '10850/list.htm' }],
|
||||
['me', { title: '南京航空航天大学计算机科学与技术学院 -- 研究生培养', suffix: '10851/list.htm' }],
|
||||
['jxdt', { title: '南京航空航天大学计算机科学与技术学院 -- 教学动态', suffix: '1977/list.htm' }],
|
||||
['xsgz', { title: '南京航空航天大学计算机科学与技术学院 -- 学生工作', suffix: '1959/list.htm' }],
|
||||
['tzgg', { title: '通知公告 | 南京航空航天大学计算机科学与技术学院', suffix: 'tzgg/list.htm' }],
|
||||
['rdxw', { title: '热点新闻 | 南京航空航天大学计算机科学与技术学院', suffix: '10846/list.htm' }],
|
||||
['xkky', { title: '学科科研 | 南京航空航天大学计算机科学与技术学院', suffix: '10849/list.htm' }],
|
||||
['be', { title: '本科生培养 | 南京航空航天大学计算机科学与技术学院', suffix: '10850/list.htm' }],
|
||||
['me', { title: '研究生培养 | 南京航空航天大学计算机科学与技术学院', suffix: '10851/list.htm' }],
|
||||
['jxdt', { title: '教学动态 | 南京航空航天大学计算机科学与技术学院', suffix: '1977/list.htm' }],
|
||||
['xsgz', { title: '学生工作 | 南京航空航天大学计算机科学与技术学院', suffix: '1959/list.htm' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
||||
const suffix = map.get(type).suffix;
|
||||
|
||||
const link = new URL(suffix, host).href;
|
||||
const cookie = await getCookie();
|
||||
const cookie = await getCookie(host);
|
||||
const gotConfig = {
|
||||
headers: {
|
||||
cookie,
|
||||
@@ -5,11 +5,11 @@ const getCookie = require('../utils/pypasswaf');
|
||||
const host = 'http://aao.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
['tzgg', { title: '南京航空航天大学教务处 -- 通知公告', suffix: '8222/list.htm' }],
|
||||
['jxfw', { title: '南京航空航天大学教务处 -- 教学服务', suffix: '8230/list.htm' }],
|
||||
['xspy', { title: '南京航空航天大学教务处 -- 学生培养', suffix: '8231/list.htm' }],
|
||||
['jxjs', { title: '南京航空航天大学教务处 -- 教学建设', suffix: '8232/list.htm' }],
|
||||
['jxzy', { title: '南京航空航天大学教务处 -- 教学资源', suffix: '8233/list.htm' }],
|
||||
['tzgg', { title: '通知公告 | 南京航空航天大学教务处', suffix: '8222/list.htm' }],
|
||||
['jxfw', { title: '教学服务 | 南京航空航天大学教务处', suffix: '8230/list.htm' }],
|
||||
['xspy', { title: '学生培养 | 南京航空航天大学教务处', suffix: '8231/list.htm' }],
|
||||
['jxjs', { title: '教学建设 | 南京航空航天大学教务处', suffix: '8232/list.htm' }],
|
||||
['jxzy', { title: '教学资源 | 南京航空航天大学教务处', suffix: '8233/list.htm' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -18,7 +18,7 @@ module.exports = async (ctx) => {
|
||||
const getDescription = Boolean(ctx.params.getDescription) || false;
|
||||
|
||||
const link = new URL(suffix, host).href;
|
||||
const cookie = await getCookie();
|
||||
const cookie = await getCookie(host);
|
||||
const gotConfig = {
|
||||
headers: {
|
||||
cookie,
|
||||
@@ -52,13 +52,13 @@ module.exports = async (ctx) => {
|
||||
// 南航新 WAF 过于敏感
|
||||
// 目前 description 需要遍历页面,会被 WAF 拦截导致无法输出
|
||||
// 考虑换一种获取 description 的方式或者将标题当作 title。
|
||||
let description = title;
|
||||
let description = title + '<br><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
if (getDescription) {
|
||||
description = itemUrl;
|
||||
if (pageType === 'htm' || pageType === 'html') {
|
||||
const response = await got(itemUrl, gotConfig);
|
||||
const $ = cheerio.load(response.data);
|
||||
description = $('.wp_articlecontent').html();
|
||||
description = $('.wp_articlecontent').html() + '<br><hr /><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module.exports = {
|
||||
'/cs/:type/:getDescription?': ['LogicJake', 'Seiry', 'qrzbing'],
|
||||
'/jwc/:type/:getDescription?': ['arcosx', 'Seiry', 'qrzbing'],
|
||||
'/yjsy/:type?': ['junfengP', 'Seiry'],
|
||||
'/cae/:type/:getDescription?': ['Seiry', 'qrzbing', 'Xm798'],
|
||||
'/jwc/:type/:getDescription?': ['arcosx', 'Seiry', 'qrzbing', 'Xm798'],
|
||||
'/yjsy/:type/:getDescription?': ['junfengP', 'Seiry', 'Xm798'],
|
||||
};
|
||||
|
||||
@@ -13,6 +13,12 @@ module.exports = {
|
||||
docs: 'https://docs.rsshub.app/university.html#nan-jing-hang-kong-hang-tian-da-xue',
|
||||
},
|
||||
],
|
||||
cae: [
|
||||
{
|
||||
title: '自动化学院',
|
||||
docs: 'https://docs.rsshub.app/university.html#nan-jing-hang-kong-hang-tian-da-xue',
|
||||
},
|
||||
],
|
||||
'www.graduate': [
|
||||
{
|
||||
title: '研究生院',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/cs/:type/:getDescription?', require('./cs/index'));
|
||||
router.get('/cae/:type/:getDescription?', require('./college/cae'));
|
||||
router.get('/cs/:type/:getDescription?', require('./college/cs'));
|
||||
router.get('/jwc/:type/:getDescription?', require('./jwc/jwc'));
|
||||
router.get('/yjsy/:type?', require('./yjsy/yjsy'));
|
||||
router.get('/yjsy/:type/:getDescription?', require('./yjsy/yjsy'));
|
||||
};
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
const host = 'http://aao.nuaa.edu.cn/';
|
||||
|
||||
/**
|
||||
* async function 获取cookie
|
||||
* @desc 返回一个可用的cookie,使用 `got` 发起请求的时候,传入到`options.headers.cookie`即可
|
||||
*/
|
||||
module.exports = async function getCookie() {
|
||||
module.exports = async function getCookie(host) {
|
||||
const browser = await require('@/utils/puppeteer')({ stealth: true });
|
||||
const page = await browser.newPage();
|
||||
await page.setRequestInterception(true);
|
||||
|
||||
+66
-41
@@ -1,55 +1,80 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const host = 'http://www.graduate.nuaa.edu.cn/';
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
const host = 'http://www.graduate.nuaa.edu.cn/';
|
||||
|
||||
const map = {
|
||||
latest: '2146/list.htm',
|
||||
yyxw: 'yyxw/list.htm',
|
||||
sjwj: 'sjwj/list.htm',
|
||||
glwj: '2017/list.htm',
|
||||
xxfw: '2147/list.htm',
|
||||
};
|
||||
|
||||
const load = (link, ctx) =>
|
||||
ctx.cache.tryGet(link, async () => {
|
||||
const response = await got(host + link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const images = $('img');
|
||||
for (let k = 0; k < images.length; k++) {
|
||||
$(images[k]).replaceWith(`<img src="${new URL($(images[k]).attr('src'), host).href}" />`);
|
||||
}
|
||||
const description = $('.wp_articlecontent').html();
|
||||
return { description };
|
||||
});
|
||||
const map = new Map([
|
||||
['tzgg', { title: '通知公告 | 南京航空航天大学研究生院', suffix: '2145/list.htm' }],
|
||||
['xwdt', { title: '新闻动态 | 南京航空航天大学研究生院', suffix: '13276/list.htm' }],
|
||||
['xsxx', { title: '学术信息 | 南京航空航天大学研究生院', suffix: '13277/list.htm' }],
|
||||
['ssfc', { title: '师生风采 | 南京航空航天大学研究生院', suffix: '13278/list.htm' }],
|
||||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? 'latest';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: host + map[type],
|
||||
});
|
||||
const type = ctx.params.type;
|
||||
const suffix = map.get(type).suffix;
|
||||
const getDescription = Boolean(ctx.params.getDescription) || false;
|
||||
const link = new URL(suffix, host).href;
|
||||
const cookie = await getCookie(host);
|
||||
const gotConfig = {
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
};
|
||||
const response = await got(link, gotConfig);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('#news_list ul.news_ul > li').slice(0, 10).get();
|
||||
const process = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const a = $(item).find('a');
|
||||
const t = $(item).find('span');
|
||||
const itemUrl = a.attr('href');
|
||||
const single = {
|
||||
title: a.text(),
|
||||
link: new URL(itemUrl, host).href,
|
||||
pubDate: parseDate(t.text(), 'YYYY-MM-DD'),
|
||||
|
||||
const list = $('#wp_news_w6 ul li')
|
||||
.slice(0, 10)
|
||||
.map(function () {
|
||||
const info = {
|
||||
title: $(this).find('a').text(),
|
||||
link: $(this).find('a').attr('href'),
|
||||
date: $(this).find('span').text(),
|
||||
};
|
||||
const other = await load(itemUrl, ctx);
|
||||
return { ...single, ...other };
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map((info) => {
|
||||
const title = info.title || 'tzgg';
|
||||
const date = info.date;
|
||||
const itemUrl = new URL(info.link, host).href;
|
||||
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const arr = itemUrl.split('.');
|
||||
const pageType = arr[arr.length - 1];
|
||||
|
||||
// 南航新 WAF 过于敏感
|
||||
// 目前 description 需要遍历页面,会被 WAF 拦截导致无法输出
|
||||
// 考虑换一种获取 description 的方式或者将标题当作 title。
|
||||
let description = title + '<br><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
if (getDescription) {
|
||||
description = itemUrl;
|
||||
if (pageType === 'htm' || pageType === 'html') {
|
||||
const response = await got(itemUrl, gotConfig);
|
||||
const $ = cheerio.load(response.data);
|
||||
description = $('.wp_articlecontent').html() + '<br><hr /><a href="' + itemUrl + '" target="_blank">查看原文</a>';
|
||||
}
|
||||
}
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: parseDate(date),
|
||||
};
|
||||
return single;
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '南航研究生院',
|
||||
link: host,
|
||||
description: '南航研究生院RSS',
|
||||
item: process,
|
||||
title: map.get(type).title,
|
||||
link,
|
||||
description: '南京航空航天大学研究生院RSS',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user