mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-01 17:48:15 +08:00
@@ -2313,6 +2313,48 @@ type 列表:
|
||||
|
||||
</Route>
|
||||
|
||||
## 西南石油大学
|
||||
|
||||
### 办公网
|
||||
|
||||
<Route author="CYTMWIA" example="/swpu/bgw/zytzgg" path="/swpu/bgw/:code" :paramsDesc="['栏目代码']">
|
||||
|
||||
| 栏目 | 重要通知公告 | 部门通知公告 | 本周活动 | 学术报告 |
|
||||
| ---- | ------------ | ------------ | -------- | -------- |
|
||||
| 代码 | zytzgg | bmtzgg | bzhd | xsbg |
|
||||
|
||||
</Route>
|
||||
|
||||
### 教务处
|
||||
|
||||
<Route author="CYTMWIA" example="/swpu/dean/tzgg" path="/swpu/dean/:code" :paramsDesc="['栏目代码']">
|
||||
|
||||
| 栏目 | 通知公告 | 新闻报道 | 视点声音 |
|
||||
| ---- | -------- | -------- | -------- |
|
||||
| 代码 | tzgg | xwbd | sdsy |
|
||||
|
||||
</Route>
|
||||
|
||||
### 计算机科学学院
|
||||
|
||||
<Route author="CYTMWIA" example="/swpu/scs/tzgg" path="/swpu/scs/:code" :paramsDesc="['栏目代码']">
|
||||
|
||||
| 栏目 | 通知公告 | 新闻速递 |
|
||||
| ---- | -------- | -------- |
|
||||
| 代码 | tzgg | xwsd |
|
||||
|
||||
</Route>
|
||||
|
||||
### 电气信息学院
|
||||
|
||||
<Route author="CYTMWIA" example="/swpu/dxy/1156" path="/swpu/dxy/:code" :paramsDesc="['栏目代码']">
|
||||
|
||||
| 栏目 | 学院新闻 | 学院通知 |
|
||||
| ---- | -------- | -------- |
|
||||
| 代码 | 1122 | 1156 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 信阳师范学院
|
||||
|
||||
### 高等教育自学考试办公室
|
||||
|
||||
58
lib/v2/swpu/bgw.js
Normal file
58
lib/v2/swpu/bgw.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const { joinUrl } = require('./utils');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.swpu.edu.cn/bgw2/${ctx.params.code}.htm`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const title = $('.title').text();
|
||||
|
||||
// 获取标题、时间及链接
|
||||
const items = [];
|
||||
$('.notice > ul > li > a').each((i, elem) => {
|
||||
items.push({
|
||||
title: $(elem.children[0]).text(),
|
||||
pubDate: timezone(parseDate($(elem.children[1]).text()), +8),
|
||||
link: joinUrl('https://www.swpu.edu.cn', $(elem).attr('href')), // 实际获得连接 "../info/1312/17891.htm"
|
||||
});
|
||||
});
|
||||
|
||||
// 请求全文
|
||||
const out = await Promise.all(
|
||||
items.map(async (item) => {
|
||||
const $ = await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got.get(item.link);
|
||||
return cheerio.load(res.data);
|
||||
});
|
||||
|
||||
if ($('title').text().startsWith('系统提示')) {
|
||||
item.author = '系统';
|
||||
item.description = '无权访问';
|
||||
} else {
|
||||
item.author = '办公网';
|
||||
item.description = $('.v_news_content').html();
|
||||
for (const elem of $('.v_news_content p')) {
|
||||
if ($(elem).css('text-align') === 'right') {
|
||||
item.author = $(elem).text();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `西南石油大学办公网 ${title}`,
|
||||
link: url,
|
||||
description: `西南石油大学办公网 ${title} 列表`,
|
||||
language: 'zh-CN',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
58
lib/v2/swpu/dean.js
Normal file
58
lib/v2/swpu/dean.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const { joinUrl } = require('./utils');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.swpu.edu.cn/dean/${ctx.params.code}.htm`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const title = $('.r_list > h3').text();
|
||||
|
||||
// 获取标题、时间及链接
|
||||
const items = [];
|
||||
$('.r_list > ul > li').each((i, elem) => {
|
||||
items.push({
|
||||
title: $('label:eq(0)', elem).text().trim(),
|
||||
link: joinUrl('https://www.swpu.edu.cn/dean/', $('a', elem).attr('href')),
|
||||
});
|
||||
});
|
||||
|
||||
// 请求全文
|
||||
const out = await Promise.all(
|
||||
items.map(async (item) => {
|
||||
const $ = await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got.get(item.link);
|
||||
return cheerio.load(res.data);
|
||||
});
|
||||
|
||||
if ($('title').text().startsWith('系统提示')) {
|
||||
item.author = '系统';
|
||||
item.description = '无权访问';
|
||||
} else {
|
||||
item.author = '教务处';
|
||||
item.description = $('.v_news_content').html();
|
||||
item.pubDate = timezone(parseDate($('#lbDate').text(), '更新时间:YYYY年MM月DD日'), +8);
|
||||
for (const elem of $('.v_news_content p')) {
|
||||
if ($(elem).css('text-align') === 'right') {
|
||||
item.author = $(elem).text();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `西南石油大学教务处 ${title}`,
|
||||
link: url,
|
||||
description: `西南石油大学教务处 ${title}`,
|
||||
language: 'zh-CN',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
61
lib/v2/swpu/dxy.js
Normal file
61
lib/v2/swpu/dxy.js
Normal file
@@ -0,0 +1,61 @@
|
||||
const { joinUrl } = require('./utils');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// 移除 urltype=tree.TreeTempUrl 虽然也能顺利访问页面,
|
||||
// 但标题会缺失,而且在其他地方定位提取标题也比较麻烦。
|
||||
const url = `https://www.swpu.edu.cn/dxy/list1.jsp?urltype=tree.TreeTempUrl&wbtreeid=${ctx.params.code}`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
let title = $('title').text();
|
||||
title = title.substring(0, title.indexOf('-'));
|
||||
|
||||
// 获取标题、时间及链接
|
||||
const items = [];
|
||||
$('tr[height="20"]').each((i, elem) => {
|
||||
items.push({
|
||||
title: $('a[title]', elem).text().trim(),
|
||||
pubDate: timezone(parseDate($('td:eq(1)', elem).text(), 'YYYY年MM月DD日'), +8),
|
||||
link: joinUrl('https://www.swpu.edu.cn/dxy/', $('a[title]', elem).attr('href')),
|
||||
});
|
||||
});
|
||||
|
||||
// 请求全文
|
||||
const out = await Promise.all(
|
||||
items.map(async (item) => {
|
||||
const $ = await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got.get(item.link);
|
||||
return cheerio.load(res.data);
|
||||
});
|
||||
|
||||
if ($('title').text().startsWith('系统提示')) {
|
||||
item.author = '系统';
|
||||
item.description = '无权访问';
|
||||
} else {
|
||||
item.author = '电气信息学院';
|
||||
item.description = $('.v_news_content').html();
|
||||
for (const elem of $('.v_news_content p')) {
|
||||
if ($(elem).css('text-align') === 'right') {
|
||||
item.author = $(elem).text();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `西南石油大学电气信息学院 ${title}`,
|
||||
link: url,
|
||||
description: `西南石油大学电气信息学院 ${title}`,
|
||||
language: 'zh-CN',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
6
lib/v2/swpu/maintainer.js
Normal file
6
lib/v2/swpu/maintainer.js
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
'/bgw/:code': ['CYTMWIA'],
|
||||
'/dean/:code': ['CYTMWIA'],
|
||||
'/dxy/:code': ['CYTMWIA'],
|
||||
'/scs/:code': ['CYTMWIA'],
|
||||
};
|
||||
31
lib/v2/swpu/radar.js
Normal file
31
lib/v2/swpu/radar.js
Normal file
@@ -0,0 +1,31 @@
|
||||
module.exports = {
|
||||
'swpu.edu.cn': {
|
||||
_name: '西南石油大学',
|
||||
'.': [
|
||||
{
|
||||
title: '办公网',
|
||||
docs: 'https://docs.rsshub.app/university.html#xi-nan-shi-you-da-xue',
|
||||
source: ['/'],
|
||||
target: '',
|
||||
},
|
||||
{
|
||||
title: '教务处',
|
||||
docs: 'https://docs.rsshub.app/university.html#xi-nan-shi-you-da-xue',
|
||||
source: ['/'],
|
||||
target: '',
|
||||
},
|
||||
{
|
||||
title: '计算机科学学院',
|
||||
docs: 'https://docs.rsshub.app/university.html#xi-nan-shi-you-da-xue',
|
||||
source: ['/'],
|
||||
target: '',
|
||||
},
|
||||
{
|
||||
title: '电气信息学院',
|
||||
docs: 'https://docs.rsshub.app/university.html#xi-nan-shi-you-da-xue',
|
||||
source: ['/'],
|
||||
target: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
6
lib/v2/swpu/router.js
Normal file
6
lib/v2/swpu/router.js
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/bgw/:code', require('./bgw'));
|
||||
router.get('/dean/:code', require('./dean'));
|
||||
router.get('/dxy/:code', require('./dxy'));
|
||||
router.get('/scs/:code', require('./scs'));
|
||||
};
|
||||
58
lib/v2/swpu/scs.js
Normal file
58
lib/v2/swpu/scs.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const { joinUrl } = require('./utils');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.swpu.edu.cn/scs/index/${ctx.params.code}.htm`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const title = $('.r_list > h3').text();
|
||||
|
||||
// 获取标题、时间及链接
|
||||
const items = [];
|
||||
$('.main_conRCb > ul > li').each((i, elem) => {
|
||||
items.push({
|
||||
title: $('em', elem).text().trim(),
|
||||
pubDate: timezone(parseDate($('span', elem).text()), +8),
|
||||
link: joinUrl('https://www.swpu.edu.cn/scs/index/', $('a', elem).attr('href')),
|
||||
});
|
||||
});
|
||||
|
||||
// 请求全文
|
||||
const out = await Promise.all(
|
||||
items.map(async (item) => {
|
||||
const $ = await ctx.cache.tryGet(item.link, async () => {
|
||||
const res = await got.get(item.link);
|
||||
return cheerio.load(res.data);
|
||||
});
|
||||
|
||||
if ($('title').text().startsWith('系统提示')) {
|
||||
item.author = '系统';
|
||||
item.description = '无权访问';
|
||||
} else {
|
||||
item.author = '计算机科学学院';
|
||||
item.description = $('.v_news_content').html();
|
||||
for (const elem of $('.v_news_content p')) {
|
||||
if ($(elem).css('text-align') === 'right') {
|
||||
item.author = $(elem).text();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `西南石油大学计算机科学学院 ${title}`,
|
||||
link: url,
|
||||
description: `西南石油大学计算机科学学院 ${title}`,
|
||||
language: 'zh-CN',
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
22
lib/v2/swpu/utils.js
Normal file
22
lib/v2/swpu/utils.js
Normal file
@@ -0,0 +1,22 @@
|
||||
function isCompleteUrl(url) {
|
||||
return /^\w+?:\/\/.*?\//.test(url);
|
||||
}
|
||||
|
||||
function joinUrl(url1, url2) {
|
||||
if (isCompleteUrl(url2)) {
|
||||
return url2;
|
||||
}
|
||||
|
||||
if (!url1.endsWith('/')) {
|
||||
url1 = url1 + '/';
|
||||
}
|
||||
if (url2.startsWith('/')) {
|
||||
url2 = url2.substr(1);
|
||||
}
|
||||
|
||||
return url1 + url2;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
joinUrl,
|
||||
};
|
||||
Reference in New Issue
Block a user