Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Crawler995/RSSHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Crawler995 committed Feb 15, 2020
2 parents 9d09920 + fcd25fc commit 484e957
Show file tree
Hide file tree
Showing 22 changed files with 555 additions and 29 deletions.
2 changes: 1 addition & 1 deletion assets/radar-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@
wjw: [
{
title: '北京卫生健康委员会',
docs: 'https://docs.rsshub.app/government.html#zhong-yang-ji-wei-guo-jia-jian-wei',
docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-wei-sheng-jian-kang-wei-yuan-hui',
source: '/xwzx_20031/:caty',
target: '/gov/beijing/mhc/:caty',
},
Expand Down
12 changes: 11 additions & 1 deletion docs/bbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ pageClass: routes

## Discuz

### 通用子版块
### 通用子版块-自动检测

<Route author="junfengP" example="/discuz/http%3a%2f%2fwww.u-share.cn%2fforum.php%3fmod%3dforumdisplay%26fid%3d56" path="/discuz/:link" :paramsDesc="['子版块链接, 需要手动Url编码']"/>

### 通用子版块-指定版本

<Route author="junfengP" example="/discuz/x/https%3a%2f%2fwww.52pojie.cn%2fforum-16-1.html" path="/discuz/:ver/:link" :paramsDesc="['discuz版本类型,见下表','子版块链接, 需要手动Url编码']" >

| Discuz X 系列 | Discuz 7.x 系列 |
| ------------- | --------------- |
| x | 7 |

</Route>

## MCBBS

### 版块
Expand Down
16 changes: 16 additions & 0 deletions docs/en/bbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ pageClass: routes
---

# BBS

## Discuz

### General Subforum - Auto detection

<Route author="junfengP" example="/discuz/http%3a%2f%2fwww.u-share.cn%2fforum.php%3fmod%3dforumdisplay%26fid%3d56" path="/discuz/:link" :paramsDesc="['link of subforum, require url encoded ']"/>

### General Subforum - Manual version

<Route author="junfengP" example="/discuz/x/https%3a%2f%2fwww.52pojie.cn%2fforum-16-1.html" path="/discuz/:ver/:link" :paramsDesc="['discuz version,see below table','link of subforum, require url encoded']" >

| Discuz X Series | Discuz 7.x Series |
| --------------- | ----------------- |
| x | 7 |

</Route>
4 changes: 4 additions & 0 deletions docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ type 为 all 时,category 参数不支持 cost 和 free
| ---- | ---- | ---- |
| ch | en | pt |

### Singapore Ministry of Health - Past Updates on 2019-nCov Local Situation in Singapore

<Route author="Gnnng" example="/coronavirus/sg-moh" path="/coronavirus/sg-moh"/>

## 新趣集

> 官方 Feed 地址为: [https://xinquji.com/rss](https://xinquji.com/rss)
Expand Down
2 changes: 1 addition & 1 deletion docs/program-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pageClass: routes

### 扩展程序更新

<Route author="DIYgod" example="/chrome/webstore/extensions/kefjpfngnndepjbopdmoebkipbgkggaa" path="/chrome/webstore/extensions/:id" :paramsDesc="['扩展程序 id, 可在应用页 URL 中找到']/>
<Route author="DIYgod" example="/chrome/webstore/extensions/kefjpfngnndepjbopdmoebkipbgkggaa" path="/chrome/webstore/extensions/:id" :paramsDesc="['扩展程序 id, 可在应用页 URL 中找到']" />

## CurseForge

Expand Down
10 changes: 10 additions & 0 deletions docs/reading.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ pageClass: routes

</Route>

## 虛詞

### 版块

<Route author="LogicJake" example="/p-articles/section/critics-art" path="/p-articles/section/:section" :paramsDesc="['版块链接, 可在对应版块 URL 中找到, 子版块链接用`-`连接']"/>

### 作者

<Route author="LogicJake" example="/p-articles/contributors/朗天" path="/p-articles/contributors/:author" :paramsDesc="['作者 id, 可在作者页面 URL 找到']"/>

## 纵横

### 章节
Expand Down
10 changes: 10 additions & 0 deletions docs/shopping.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ For instance, in https://www.leboncoin.fr/recherche/?**category=10&locations=Par

<Route author="fengkx" example="/duozhuayu/search/JavaScript" path="/duozhuayu/search/:wd" :paramsDesc="['搜索关键词']"/>

## 好好住

### 整屋案例

<Route author="hoilc" example="/haohaozhu/whole-house/日式" path="/haohaozhu/whole-house/:keyword?" :paramsDesc="['分类名或关键字,请使用中文']"/>

### 发现

<Route author="hoilc" example="/haohaozhu/discover/厨房" path="/haohaozhu/discover/:keyword?" :paramsDesc="['分类名或关键字,请使用中文']"/>

## 京东众筹

### 众筹项目
Expand Down
24 changes: 24 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ xskb1 对应 http://www.auto.uestc.edu.cn/index/xskb1.htm

</Route>

## 东北大学

### 东北大学新闻网

<Route author="JeasonLau" example="/neu/news/ddyw" path="/neu/news/:type" :paramsDesc="['种类名']">

| 东大要闻 | 媒体东大 | 通知公告 | 新闻纵横 | 人才培养 | 学术科研 | 英文新闻 | 招生就业 | 考研出国 | 校园文学 | 校友风采 |
| -------- | -------- | -------- | -------- | -------: | -------- | -------- | -------- | -------- | -------- | -------- |
| ddyw | mtdd | tzgg | xwzh | rcpy | xsky | 217 | zsjy | kycg | xywx | xyfc |

</Route>

## 东莞理工学院

### 教务处通知
Expand Down Expand Up @@ -1177,6 +1189,18 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet

<Route author="sanmmm" example="/cug/graduate" path="/cug/graduate" />

## 中国海洋大学

### 信息科学与工程学院

<Route author="Geo" example="/ouc/it/0" path="/universities/ouc/it/:type?" :paramsDesc="['默认为 `0`']">

| 学院要闻 | 学院公告 | 学院活动 |
| -------- | -------- | -------- |
| 0 | 1 | 2 |

</Route>

## 中国科学院

### 上海微系统与信息技术研究所学术活动
Expand Down
16 changes: 16 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@ router.get('/sdu/cmse/:type?', require('./routes/universities/sdu/cmse'));
router.get('/sdu/mech/:type?', require('./routes/universities/sdu/mech'));
router.get('/sdu/epe/:type?', require('./routes/universities/sdu/epe'));

// 中国海洋大学
router.get('/ouc/it/:type?', require('./routes/universities/ouc/it'));

// 大连大学
router.get('/dlu/jiaowu/news', require('./routes/universities/dlu/jiaowu/news'));

Expand Down Expand Up @@ -2155,6 +2158,7 @@ router.get('/gbcc/trust', require('./routes/gbcc/trust'));
router.get('/apnews/topics/:topic', require('./routes/apnews/topics'));

// discuz
router.get('/discuz/:ver([7|x])/:link(.*)', require('./routes/discuz/discuz'));
router.get('/discuz/:link(.*)', require('./routes/discuz/discuz'));

// China Dialogue 中外对话
Expand All @@ -2178,6 +2182,7 @@ router.get('/coronavirus/scmp', require('./routes/coronavirus/scmp'));
router.get('/coronavirus/nhc', require('./routes/coronavirus/nhc'));
router.get('/coronavirus/mogov-2019ncov/:lang', require('./routes/coronavirus/mogov-2019ncov'));
router.get('/coronavirus/qq/fact', require('./routes/tencent/factcheck'));
router.get('/coronavirus/sg-moh', require('./routes/coronavirus/sg-moh'));

// 南京林业大学教务处
router.get('/njfu/jwc/:category?', require('./routes/universities/njfu/jwc'));
Expand Down Expand Up @@ -2234,4 +2239,15 @@ router.get('/2048/bbs/:fid', require('./routes/2048/bbs'));
// Google News
router.get('/google/news/:category/:locale', require('./routes/google/news'));

// 虛詞
router.get('/p-articles/section/:section', require('./routes/p-articles/section'));
router.get('/p-articles/contributors/:author', require('./routes/p-articles/contributors'));

// 好好住
router.get('/haohaozhu/whole-house/:keyword?', require('./routes/haohaozhu/whole-house'));
router.get('/haohaozhu/discover/:keyword?', require('./routes/haohaozhu/discover'));

// 东北大学
router.get('/neu/news/:type', require('./routes/universities/neu/news'));

module.exports = router;
49 changes: 49 additions & 0 deletions lib/routes/coronavirus/sg-moh.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const dataUrl = 'https://www.moh.gov.sg/2019-ncov-wuhan/past-updates';
const response = await got({
method: 'get',
url: dataUrl,
});

const $ = cheerio.load(response.data);
const list = $('section.body-content div.sfContentBlock:nth-of-type(2) table tr').slice(1, 21);

const items = list
.filter((_, item) => {
item = $(item);
const dateRaw = item
.find('td:first-child')
.text()
.trim();
return dateRaw !== 'Date';
})
.map((_, item) => {
item = $(item);
const title = `${item
.find('a')
.first()
.text()}`;
const dateRaw = item
.find('td:first-child')
.text()
.trim();
const pubDate = Date.parse(dateRaw) && dateRaw;
const link = item.find('a').attr('href');
return {
title,
pubDate,
link,
};
})
.get();

ctx.state.data = {
title: 'Past Updates On 2019-NCOV Local Situation',
link: dataUrl,
description: 'Past Updates On 2019-NCOV Local Situation',
item: items,
};
};
20 changes: 8 additions & 12 deletions lib/routes/discuz/discuz.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ async function load(baseUrl, itemLink, ctx, charset) {

module.exports = async (ctx) => {
let link = ctx.params.link;
const ver = ctx.params.ver ? ctx.params.ver.toUpperCase() : undefined;
link = link.replace(/:\/\//, ':/').replace(/:\//, '://');

const response = await got.get(link);
Expand All @@ -52,18 +53,18 @@ module.exports = async (ctx) => {
let charset = 'utf-8';
for (const attr of contentType.split(';')) {
if (attr.indexOf('charset=') >= 0) {
charset = attr.split('=').pop();
charset = attr
.split('=')
.pop()
.toLowerCase();
}
}
const responseData = charset === 'utf-8' ? response.data : iconv.decode((await got.get({ url: link, responseType: 'buffer' })).data, charset);
const $ = cheerio.load(responseData);
const title = $('head > title').text();
const version = ver ? 'DISCUZ! ' + ver : $('head > meta[name=generator]').attr('content');
let process;
if (
$('div#footer p em')
.text()
.startsWith('7')
) {
if (version.toUpperCase().startsWith('DISCUZ! 7')) {
// discuz 7.x 系列
// 支持全文抓取,限制抓取页面5个
const list = $('tbody[id^="normalthread"] tr')
Expand All @@ -82,12 +83,7 @@ module.exports = async (ctx) => {
return Promise.resolve(Object.assign({}, single, detail));
})
);
} else if (
$('div#frt p em')
.text()
.toUpperCase()
.startsWith('X')
) {
} else if (version.toUpperCase().startsWith('DISCUZ! X')) {
// discuz X 系列
// 支持全文抓取,限制抓取页面5个
const list = $('tbody[id^="normalthread"] tr')
Expand Down
11 changes: 3 additions & 8 deletions lib/routes/dsndsht23/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,13 @@ const forumIdMaps = {
module.exports = async (ctx) => {
const subformName = ctx.params.subforumid || 'gqzwzm';
const subformId = subformName in forumIdMaps ? forumIdMaps[subformName] : subformName;
const typefilter = ctx.params.type ? `&filter=type&typeid=${ctx.params.type}` : '';
const typefilter = ctx.params.type ? `&filter=typeid&typeid=${ctx.params.type}` : '';
const link = `${host}forum.php?mod=forumdisplay&fid=${subformId}${typefilter}`;
const response = await got.get(link);
const $ = cheerio.load(response.data);

const list = $('#threadlisttableid tbody')
.slice(1, 21)
.filter(function() {
// 去除置顶帖子和分割线
const threadID = $(this).attr('id');
return typeof threadID !== 'undefined' && threadID !== 'separatorline' && !threadID.startsWith('stickthread');
})
const list = $('#threadlisttableid tbody[id^=normalthread]')
.slice(0, 11)
.map(function() {
const info = {
title:
Expand Down
5 changes: 5 additions & 0 deletions lib/routes/github/file.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const got = require('@/utils/got');
const config = require('@/config').value;
const queryString = require('query-string');

module.exports = async (ctx) => {
const user = ctx.params.user;
Expand All @@ -14,6 +15,10 @@ module.exports = async (ctx) => {
headers.Authorization = `token ${config.github.access_token}`;
}
const res = await got.get(`https://api.github.com/repos/${user}/${repo}/commits`, {
searchParams: queryString.stringify({
sha: branch,
path: filepath,
}),
headers,
});
const list = res.data;
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/gov/beijing/mhc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const config = {
module.exports = async (ctx) => {
const cfg = config[ctx.params.caty];
if (!cfg) {
throw Error('Bad category. See <a href="https://docs.rsshub.app/government.html#zhong-yang-ji-wei-guo-jia-jian-wei">docs</a>');
throw Error('Bad category. See <a href="https://docs.rsshub.app/government.html#bei-jing-shi-wei-sheng-jian-kang-wei-yuan-hui">docs</a>');
}

const current_url = url.resolve(root_url, cfg.link);
Expand Down
42 changes: 42 additions & 0 deletions lib/routes/haohaozhu/discover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const got = require('@/utils/got');

module.exports = async (ctx) => {
const keyword = ctx.params.keyword && ctx.params.keyword !== 'all' && ctx.params.keyword !== '全部' ? ctx.params.keyword : '';

const url = 'https://www.haohaozhu.cn/community/discover';

const response = await got({
method: 'post',
url: 'https://www.haohaozhu.cn/f/y/api/Share/AllPhotoInPc',
headers: {
Referer: url,
},
form: {
keyword: keyword,
page: 1,
time: new Date().getTime(),
},
});

const list = response.data.data.rows;

ctx.state.data = {
title: `好好住 - 发现${keyword ? ' - ' + keyword : ''}`,
link: url,
item: list
.map((item) => {
if (item.is_advertisement !== 0 || !item.photo || !item.photo.photo_info) {
return '';
}
return {
title: item.photo.photo_info.remark,
author: item.photo.user_info.nick,
description: item.photo.photo_info.image_list.map((image) => `<img src="${image.ori_pic_url}" style="max-width: 100%;" />`).join(''),
link: url,
guid: item.photo.photo_info.id,
pubDate: new Date(item.photo.photo_info.addtime * 1000),
};
})
.filter((item) => item !== ''),
};
};
Loading

0 comments on commit 484e957

Please sign in to comment.