Skip to content

Commit

Permalink
Merge pull request #574 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Nov 16, 2022
2 parents 9622bbd + 7521ef2 commit 361b074
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 12 deletions.
67 changes: 67 additions & 0 deletions docs/en/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,73 @@ Note: [Source website](https://gs.bjtu.edu.cn/) only provides articles in Chines

<RouteEn author="nczitzk" example="/mit/csail/news" path="/mit/csail/news"/>

## Nanjing University of the Arts

### Official Information

<RouteEn author="evnydd0sf" example="/nua/index/346" path="/nua/index/:type" :paramsDesc="['News Type']" radar="1">

| News Type | Parameters |
| ---- | --- |
| 公告 | 346 |
| 南艺要闻 | 332 |

</RouteEn>

### Shuangxing Information

<RouteEn author="evnydd0sf" example="/nua/sxw/230" path="/nua/sxw/:type" :paramsDesc="['News Type']" radar="1">

| News Type | Parameters |
| ---- | --- |
| 校园电视 | 230 |
| 院部动态 | 232 |
| 动感校园 | 233 |
| 招就指南 | 234 |
| 南艺院报 | 236 |

</RouteEn>

### School of Design

<RouteEn author="evnydd0sf" example="/nua/dc/news" path="/nua/dc/:type" :paramsDesc="['News Type']" radar="1">

| News Type | Parameters |
| ---------------------- | ---------- |
| 学院新闻 NEWS | news |
| 展览 EXHIBITION | exhibition |
| 研创 RESEARCH & CREATION | rc |
| 项目 PROJECT | project |
| 党团 PARTY | party |
| 后浪 YOUTH | youth |

</RouteEn>

### Graduate Institute

<RouteEn author="evnydd0sf" example="/nua/gra/1959" path="/nua/gra/:type" :paramsDesc="['News Type']" radar="1">

| News Type | Parameters |
| ---- | ---- |
| 招生工作 | 1959 |
| 培养工作 | 1962 |
| 学位工作 | 1958 |

</RouteEn>

### Library

<RouteEn author="evnydd0sf" example="/nua/lib/xwdt" path="/nua/lib/:type" :paramsDesc="['News Type']" radar="1">

| News Type | Parameters |
| ---- | ---- |
| 新闻动态 | xwdt |
| 党建动态 | djdt |
| 资源动态 | zydt |
| 服务动态 | fwdt |

</RouteEn>

## Polimi

### News
Expand Down
6 changes: 6 additions & 0 deletions docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ type 为 all 时,category 参数不支持 cost 和 free

<Route author="LogicJake" example="/kpmg/insights" path="/kpmg/insights" />

## 成都住建蓉 e 办

### 商品住房购房登记

<Route author="TonyRL" example="/cdzjryb/zw/projectList" path="/cdzjryb/zw/projectList" radar="1"/>

## 滴答清单

### 习惯打卡
Expand Down
13 changes: 13 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,19 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS

</Route>

### 图书馆

<Route author="evnydd0sf" example="/nua/lib/xwdt" path="/nua/lib/:type" :paramsDesc="['新闻模块,见下表']" radar="1">

| 新闻模块 | 参数 |
| ---- | ---- |
| 新闻动态 | xwdt |
| 党建动态 | djdt |
| 资源动态 | zydt |
| 服务动态 | fwdt |

</Route>

## 南京邮电大学

### 教务处通知与新闻
Expand Down
3 changes: 3 additions & 0 deletions lib/v2/cdzjryb/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/zw/projectList': ['TonyRL'],
};
49 changes: 49 additions & 0 deletions lib/v2/cdzjryb/projectList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const { art } = require('@/utils/render');
const path = require('path');

module.exports = async (ctx) => {
const url = 'https://zw.cdzjryb.com/lottery/accept/projectList';
const { data: response } = await got(url);
const $ = cheerio.load(response);

const list = $('#_projectInfo tr')
.toArray()
.map((item) =>
$(item)
.find('td')
.toArray()
.map((td) => $(td).text().trim())
);

const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(`cdzjryb:zw:projectList${item[0]}`, async () => {
const { data: notice } = await got.post('https://zw.cdzjryb.com/lottery/accept/getProjectRule', {
form: {
projectUuid: item[0],
},
});
return {
title: item[3],
description: art(path.join(__dirname, 'templates/projectList.art'), {
item,
notice: notice.message,
}),
link: url,
guid: `cdzjryb:zw:projectList:${item[0]}`,
pubDate: timezone(parseDate(item[8]), 8),
};
})
)
);

ctx.state.data = {
title: $('head title').text(),
link: url,
item: items,
};
};
13 changes: 13 additions & 0 deletions lib/v2/cdzjryb/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'cdzjryb.com': {
_name: '成都住建蓉 e 办',
zw: [
{
title: '商品住房购房登记',
docs: 'https://docs.rsshub.app/other.html#cheng-dou-zhu-jian-rong-e-ban',
source: ['/lottery/accept/projectList', '/'],
target: '/cdzjryb/zw/projectList',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/cdzjryb/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/zw/projectList', require('./projectList'));
};
23 changes: 23 additions & 0 deletions lib/v2/cdzjryb/templates/projectList.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<table>
<tr>
<th>区域</th>
<th>项目名称</th>
<th>预售证号</th>
<th>预售范围</th>
<th>住房套数</th>
<th>开发商咨询电话</th>
<th>登记开始时间</th>
<th>登记结束时间</th>
<th>名单外人员资格已释放时间</th>
<th>名单内人员资格已释放时间</th>
<th>预审码取得截止时间</th>
<th>项目报名状态</th>
</tr>
<tr>
<% for(let i = 2; i < item.length - 1; i++){ %>
<td><%= item[i] %></td>
<% } %>
</tr>
</table>
<h2 style="text-align: center;">登记规则</h2>
{{@ notice }}
39 changes: 39 additions & 0 deletions lib/v2/nua/lib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const util = require('./utils');
const baseUrl = 'https://lib.nua.edu.cn';

module.exports = async (ctx) => {
const type = ctx.params.type;
let webPageName;

switch (type) {
case 'xwdt':
webPageName = '.wp_column.column-1.selected';
break;
case 'djdt':
webPageName = '.wp_column.column-2.selected';
break;
case 'zydt':
webPageName = '.wp_column.column-3.selected';
break;
case 'fwdt':
webPageName = '.wp_column.column-4.selected';
break;
default:
throw Error(`暂不支持对${type}的订阅`);
}

const newsUrl = `${baseUrl}/${type}/list.htm`;
const listName = 'div.news_con';
const artiContent = '.wp_articlecontent';
const listDate = '.news_date';

const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName);
const results = await util.ProcessFeed(items[0], artiContent, ctx);

ctx.state.data = {
title: 'NUA-图书馆-' + items[1],
link: `${baseUrl}/${type}/list.htm`,
description: '南京艺术学院 图书馆 ' + items[1],
item: results,
};
};
1 change: 1 addition & 0 deletions lib/v2/nua/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module.exports = {
'/dc/:type': ['evnydd0sf'],
'/gra/:type': ['evnydd0sf'],
'/index/:type': ['evnydd0sf'],
'/lib/:type': ['evnydd0sf'],
'/sxw/:type': ['evnydd0sf'],
};
8 changes: 8 additions & 0 deletions lib/v2/nua/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,13 @@ module.exports = {
target: '/nua/gra/:type',
},
],
lib: [
{
title: '图书馆',
docs: 'https://docs.rsshub.app/university.html#nan-jing-yi-shu-xue-yuan',
source: ['/:type/list.htm'],
target: '/nua/lib/:type',
},
],
},
};
1 change: 1 addition & 0 deletions lib/v2/nua/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module.exports = function (router) {
router.get('/dc/:type', require('./dc'));
router.get('/gra/:type', require('./gra'));
router.get('/index/:type', require('./index'));
router.get('/lib/:type', require('./lib'));
router.get('/sxw/:type', require('./sxw'));
};
19 changes: 7 additions & 12 deletions lib/v2/nua/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,21 @@ function arti_link(text, href) {
}

async function ProcessList(newsUrl, baseUrl, listName, listDate, webPageName) {
const result = await got(newsUrl, {
https: {
rejectUnauthorized: false,
},
});
const result = await got(newsUrl, { https: { rejectUnauthorized: false } });
const $ = cheerio.load(result.data);

const pageName = $(webPageName).text();
const pageName = $(webPageName).text().trim();

const items = $(listName)
.toArray()
.map((item) => {
item = $(item);
const href = $(item).find('a').attr('href');
const type = pageType(href);

return {
link: type === 'in-nua' ? baseUrl + href : href,
title: item.find('a').attr('title'),
pubDate: timezone(parseDate(item.find(listDate).first().text(), 'YYYY-MM-DD'), +8),
title: $(item).find('a').attr('title'),
pubDate: timezone(parseDate($(item).find(listDate).first().text(), 'YYYY-MM-DD'), +8),
type,
};
});
Expand All @@ -55,14 +50,14 @@ const ProcessFeed = async (items, artiContent, ctx) =>
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
switch (item.type) {
case 'in-nua' || 'nua':
// eslint-disable-next-line no-case-declarations
case 'in-nua':
case 'nua': {
const result = await got(item.link, { https: { rejectUnauthorized: false } });
// eslint-disable-next-line no-case-declarations
const $ = cheerio.load(result.data);
item.author = $('.arti_publisher').text() + ' ' + $('.arti_views').text();
item.description = $(artiContent).html();
return item;
}
case 'wechat-mp':
return fetchArticle(ctx, item.link);
case 'unknown':
Expand Down

1 comment on commit 361b074

@vercel
Copy link

@vercel vercel bot commented on 361b074 Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.