Skip to content

Commit

Permalink
Merge pull request #832 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 Feb 21, 2023
2 parents b1a3477 + e2a1214 commit 77514a6
Show file tree
Hide file tree
Showing 27 changed files with 408 additions and 102 deletions.
4 changes: 4 additions & 0 deletions docs/government.md
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,10 @@ pageClass: routes

</Route>

### 司局通知

<Route author="TonyRL" example="/gov/moe/s78/A13" path="/gov/moe/s78/:column" :paramsDesc="['司局 ID,可在 URL 找到']" radar="1"/>

## 中华人民共和国农业农村部

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

</Route>

## 汽油价格网

### 今日油价查询

<Route author="TonyRL" example="/qiyoujiage/shanghai" path="/qiyoujiage/:path*" :paramsDesc="['路径']">

::: tip 提示

路径处填写对应页面 URL 中 `http://www.qiyoujiage.com/``.shtml` 之间的字段。下面是一个例子。

若订阅 [福建漳州龙海今日油价](http://www.qiyoujiage.com/fujian/zhangzhou/longhai.shtml) 则将对应页面 URL <http://www.qiyoujiage.com/fujian/zhangzhou/longhai.shtml>`http://www.qiyoujiage.com/``.shtml` 之间的字段 `fujian/zhangzhou/longhai` 作为路径填入。此时路由为 [`/qiyoujiage/fujian/zhangzhou/longhai`](https://rsshub.app/qiyoujiage/fujian/zhangzhou/longhai)

:::

</Route>

## 且听风吟福利

### 分类
Expand Down Expand Up @@ -925,12 +941,6 @@ type 为 all 时,category 参数不支持 cost 和 free
<Route author="kt286" example="/mail/imap/[email protected]" path="/mail/imap/:email" :paramsDesc="['邮箱账号']" selfhost="1"/>

## 油价

### 今日油价

<Route author="xyqfer" example="/oilprice/shanghai" path="/oilprice/:area" :paramsDesc="['地区拼音,详见[成品油价格网](http://oil.usd-cny.com/)']"/>

## 有据

### 最新文章列表
Expand Down
38 changes: 33 additions & 5 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,16 @@ pageClass: routes

<Route author="markmingjie" example="/bjfu/kjc" path="/bjfu/kjc" />

### 信息学院通知

<Route author="wzc-blog" example="/bjfu/it/xyxw" path="/bjfu/it/:type" :paramsDesc="['通知类别']">

| 学院新闻 | 科研动态 | 本科生培养 | 研究生培养 |
| ---- | ---- | ----- | ----- |
| xyxw | kydt | pydt | pydt2 |

</Route>

### 教务处通知公告

<Route author="markmingjie" example="/bjfu/jwc/jwkx" path="/bjfu/jwc/:type" :paramsDesc="['通知类别']">
Expand Down Expand Up @@ -310,13 +320,27 @@ pageClass: routes

</Route>

### 信息学院通知
### 图书馆通知

<Route author="wzc-blog" example="/bjfu/it/xyxw" path="/bjfu/it/:type" :paramsDesc="['通知类别']">
<Route author="TonyRL" example="/bnu/lib/zydt" path="/bjfu/lib/:category?" :paramsDesc="['分类,见下表,默认为 `zydt`']" radar="1">

| 学院新闻 | 科研动态 | 本科生培养 | 研究生培养 |
| ---- | ---- | ----- | ----- |
| xyxw | kydt | pydt | pydt2 |
| 资源动态 | 新闻动态 | 系列讲座 |
| ---- | ---- | ----- |
| zydt | xwdt | xljz1 |

</Route>

### 党委学生工作部辅导员发展中心

<Route author="TonyRL" example="/bnu/fdy/tzgg/dwjs" path="/bnu/fdy/:path*" :paramsDesc="['路径,默认为 `tzgg`']" radar="1">

::: tip 提示

路径处填写对应页面 URL 中 `https://fdy.bnu.edu.cn/``/index.htm` 之间的字段。下面是一个例子。

若订阅 [通知公告 > 队伍建设](https://fdy.bnu.edu.cn/tzgg/dwjs/index.htm) 则将对应页面 URL <https://fdy.bnu.edu.cn/tzgg/dwjs/index.htm>`https://fdy.bnu.edu.cn/``/index.htm` 之间的字段 `tzgg/dwjs` 作为路径填入。此时路由为 [`/bnu/fdy/tzgg/dwjs`](https://rsshub.app/bnu/fdy/tzgg/dwjs)

:::

</Route>

Expand Down Expand Up @@ -3021,6 +3045,10 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS

## 西南交通大学

### 就业招聘信息

<Route author="qizidog" example="/swjtu/jyzpxx" path="/swjtu/jyzpxx"/>

### 交通运输与物流学院

#### 研究生通知
Expand Down
3 changes: 0 additions & 3 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,6 @@ router.get('/chouti/:subject?', lazyloadRouteHandler('./routes/chouti'));
// Westore
router.get('/westore/new', lazyloadRouteHandler('./routes/westore/new'));

// 油价
router.get('/oilprice/:area', lazyloadRouteHandler('./routes/oilprice'));

// nHentai
router.get('/nhentai/search/:keyword/:mode?', lazyloadRouteHandler('./routes/nhentai/search'));
router.get('/nhentai/:key/:keyword/:mode?', lazyloadRouteHandler('./routes/nhentai/other'));
Expand Down
66 changes: 0 additions & 66 deletions lib/routes/oilprice/index.js

This file was deleted.

41 changes: 41 additions & 0 deletions lib/v2/bnu/fdy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const baseUrl = 'http://fdy.bnu.edu.cn';
const { path = 'tzgg' } = ctx.params;
const link = `${baseUrl}/${path}/index.htm`;

const { data: response } = await got(link);
const $ = cheerio.load(response);

const list = $('.listconrl li')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a');
return {
title: a.attr('title'),
link: new URL(a.attr('href'), link).href,
pubDate: parseDate(item.find('.news-dates').text()),
};
});

const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = cheerio.load(response);
item.description = $('.listconrc-newszw').html();
return item;
})
)
);

ctx.state.data = {
title: $('head title').text(),
link,
item: items,
};
};
40 changes: 40 additions & 0 deletions lib/v2/bnu/lib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const baseUrl = 'http://www.lib.bnu.edu.cn';
const { category = 'zydt' } = ctx.params;
const link = `${baseUrl}/${category}/index.htm`;

const { data: response } = await got(link);
const $ = cheerio.load(response);

const list = $('.view-content .item-list li')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('a').text(),
link: `${baseUrl}/${category}/${item.find('a').attr('href')}`,
pubDate: parseDate(item.find('span > span').eq(1).text(), 'YYYY-MM-DD'),
};
});

const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = cheerio.load(response);
item.description = $('#block-system-main .content .content').html();
return item;
})
)
);

ctx.state.data = {
title: $('head title').text(),
link,
item: items,
};
};
3 changes: 3 additions & 0 deletions lib/v2/bnu/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
'/bs/:category?': ['nczitzk'],
'/dwxgb/:category/:type': ['Fatpandac'],
'/fdy/:path*': ['TonyRL'],
'/lib/:category?': ['TonyRL'],
};
28 changes: 23 additions & 5 deletions lib/v2/bnu/radar.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
module.exports = {
'bnu.edu.cn': {
_name: '北京师范大学',
'.': [
bs: [
{
title: '经济与工商管理学院',
docs: 'https://docs.rsshub.app/university.html#bei-jing-shi-fan-da-xue',
source: ['/'],
target: '/bs/:category?',
source: ['/:category/index.html'],
target: '/bnu/bs/:category',
},
],
dwxgb: [
{
title: '经济与工商管理学院',
title: '党委学生工作部',
docs: 'https://docs.rsshub.app/university.html#bei-jing-shi-fan-da-xue',
source: ['/'],
source: ['/:category/:type/index.html'],
target: '/bnu/dwxgb/:category/:type',
},
],
fdy: [
{
title: '党委学生工作部辅导员发展中心',
docs: 'https://docs.rsshub.app/university.html#bei-jing-shi-fan-da-xue',
source: ['/'],
target: (_, url) => `/bnu/fdy${new URL(url).pathname.replace(/\/index\.htm(l)?$/, '')}`,
},
],
'www.lib': [
{
title: '图书馆通知',
docs: 'https://docs.rsshub.app/university.html#bei-jing-shi-fan-da-xue',
source: ['/:category/index.htm'],
target: '/bnu/lib/:category',
},
],
},
};
2 changes: 2 additions & 0 deletions lib/v2/bnu/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module.exports = function (router) {
router.get('/bs/:category?', require('./bs'));
router.get('/dwxgb/:category/:type', require('./dwxgb'));
router.get('/fdy/:path*', require('./fdy'));
router.get('/lib/:category?', require('./lib'));
};
1 change: 1 addition & 0 deletions lib/v2/gov/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
'/miit/wjgs': ['Yoge-Code'],
'/miit/zcjd': ['Yoge-Code'],
'/moe/:type': ['Crawler995'],
'/moe/s78/:column': ['TonyRL'],
'/mofcom/article/:suffix+': ['LogicJake'],
'/moj/aac/news/:type?': ['TonyRL'],
'/nifdc/:path+': ['nczitzk'],
Expand Down
8 changes: 4 additions & 4 deletions lib/v2/gov/moe/moe.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = async (ctx) => {
let id = '';
let name = '';

for (let i = 0; i < typesIdMap.length; i++) {
if (typesIdMap[i].type === type) {
id = typesIdMap[i].id;
name = typesIdMap[i].name;
for (const item of typesIdMap) {
if (item.type === type) {
id = item.id;
name = item.name;
}
}

Expand Down
44 changes: 44 additions & 0 deletions lib/v2/gov/moe/s78.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');

module.exports = async (ctx) => {
const baseUrl = 'https://www.moe.gov.cn';
const { column } = ctx.params;
const link = `${baseUrl}/s78/${column}/tongzhi/`;

const { data: response } = await got(link);
const $ = cheerio.load(response);

const list = $('#list li')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('a').attr('title'),
link: new URL(item.find('a').attr('href'), link).href,
pubDate: timezone(parseDate(item.find('span').text(), 'YYYY-MM-DD'), +8),
};
});

const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = cheerio.load(response);

$('#moe-detail-page-set, #moeCode, .moe-detail-shuxing, h1').remove();
item.description = $('.moe-detail-box').html();

return item;
})
)
);

ctx.state.data = {
title: `${$('meta[name="ColumnType"]').attr('content')} - ${$('head title').text()}`,
link,
item: items,
};
};
Loading

1 comment on commit 77514a6

@vercel
Copy link

@vercel vercel bot commented on 77514a6 Feb 21, 2023

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.