diff --git a/docs/university.md b/docs/university.md index cfe0830b1..c19ac4135 100644 --- a/docs/university.md +++ b/docs/university.md @@ -3011,7 +3011,9 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS ### 交通运输与物流学院 - +#### 研究生通知 + + ## 西南科技大学 diff --git a/lib/router.js b/lib/router.js index e9a9532c3..0911642e1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2631,9 +2631,6 @@ router.get('/hnust/art', lazyloadRouteHandler('./routes/universities/hnust/art/i router.get('/hnust/chem', lazyloadRouteHandler('./routes/universities/hnust/chem/index')); router.get('/hnust/graduate/:type?', lazyloadRouteHandler('./routes/universities/hnust/graduate/index')); -// 西南交通大学 -router.get('/swjtu/tl/news', lazyloadRouteHandler('./routes/swjtu/tl/news')); - // AGE动漫 // router.get('/agefans/detail/:id', lazyloadRouteHandler('./routes/agefans/detail')); // router.get('/agefans/update', lazyloadRouteHandler('./routes/agefans/update')); diff --git a/lib/routes/swjtu/tl/news.js b/lib/routes/swjtu/tl/news.js deleted file mode 100644 index 8d4ad29f8..000000000 --- a/lib/routes/swjtu/tl/news.js +++ /dev/null @@ -1,35 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const url = require('url'); - -module.exports = async (ctx) => { - const index_url = 'https://ctt.swjtu.edu.cn/xwdt.htm'; - const response = await got({ - method: 'get', - url: index_url, - }); - - const data = response.data; - - const $ = cheerio.load(data); - const list = $('div.news_item'); - - ctx.state.data = { - title: $('title').text(), - link: index_url, - item: - list && - list - .map((index, item) => { - item = $(item); - const link = url.resolve(index_url, item.find('a').eq(1).attr('href')); - return { - title: item.children('div.news_item_title').text(), - description: `网页链接`, - link, - pubDate: new Date(item.children('div.news_item_time').text()), - }; - }) - .get(), - }; -}; diff --git a/lib/v2/swjtu/jtys/yjs.js b/lib/v2/swjtu/jtys/yjs.js new file mode 100644 index 000000000..df13855a4 --- /dev/null +++ b/lib/v2/swjtu/jtys/yjs.js @@ -0,0 +1,37 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +const rootURL = 'https://ctt.swjtu.edu.cn'; +const url_addr = `${rootURL}/yethan/WebIndexAction?setAction=newsList&bigTypeId=0E4BF4D36E232918`; + +module.exports = async (ctx) => { + const resp = await got({ + method: 'get', + url: url_addr, + }); + + const $ = cheerio.load(resp.data); + const list = $("[class='news-list flex']"); + + ctx.state.data = { + title: '西南交大交运学院-研究生通知', + link: url_addr, + item: + list && + list + .toArray() + .map((i) => { + const item = $(i); + const news_info = item.find('div[class="news-title newsInfo"]'); + const news_month = item.find('.month'); + const news_day = item.find('.day'); + return { + title: `标题:${news_info.text()}`, + pubDate: parseDate(`${news_month.text()}.${news_day.text()}`), + link: `${rootURL}/yethan/WebIndexAction?setAction=newsInfo&newsId=${news_info.attr('newsid')}`, + }; + }), + allowEmpty: true, + }; +}; diff --git a/lib/v2/swjtu/maintainer.js b/lib/v2/swjtu/maintainer.js new file mode 100644 index 000000000..7ebf1e430 --- /dev/null +++ b/lib/v2/swjtu/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/jtys/yjs': ['qizidog'], +}; diff --git a/lib/v2/swjtu/radar.js b/lib/v2/swjtu/radar.js new file mode 100644 index 000000000..c9c280ca3 --- /dev/null +++ b/lib/v2/swjtu/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'swjtu.edu.cn': { + _name: '西南交通大学', + ctt: [ + { + title: '交通运输与物流学院 - 研究生通知', + docs: 'https://docs.rsshub.app/university.html#xi-nan-jiao-tong-da-xue', + source: ['/yethan/WebIndexAction', '/'], + target: (_, url) => (new URL(url).searchParams.get('setAction') === 'newsList' && new URL(url).searchParams.get('bigTypeId') === '0E4BF4D36E232918' ? '/swjtu/jtys/yjs' : null), + }, + ], + }, +}; diff --git a/lib/v2/swjtu/router.js b/lib/v2/swjtu/router.js new file mode 100644 index 000000000..fa5fd6b1a --- /dev/null +++ b/lib/v2/swjtu/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/jtys/yjs', require('./jtys/yjs')); +};