feat(route): fix route swjtu (#11827)
* fix(route): fix swjtu rss * fix(route): add swjtu rss publish time * fix(route): swjtu rss parse date optimization, add maintainer file * Update lib/v2/swjtu/jtys/yjs.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/swjtu/jtys/yjs.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/swjtu/jtys/yjs.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/swjtu/jtys/yjs.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * fix(route): add swjtu radar file and adjust doc ---------
This commit is contained in:
parent
26da35c922
commit
db7481218a
|
|
@ -3011,7 +3011,9 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
|||
|
||||
### 交通运输与物流学院
|
||||
|
||||
<Route author="zoenglinghou" example="/swjtu/tl/news" path="/swjtu/tl/news"/>
|
||||
#### 研究生通知
|
||||
|
||||
<Route author="zoenglinghou qizidog" example="/swjtu/jtys/yjs" path="/swjtu/jtys/yjs"/>
|
||||
|
||||
## 西南科技大学
|
||||
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -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: `<a href="${link}">网页链接</a>`,
|
||||
link,
|
||||
pubDate: new Date(item.children('div.news_item_time').text()),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/jtys/yjs': ['qizidog'],
|
||||
};
|
||||
|
|
@ -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),
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/jtys/yjs', require('./jtys/yjs'));
|
||||
};
|
||||
Loading…
Reference in New Issue