Skip to content

Commit 89181d1

Browse files
authored
Merge pull request #892 from DIYgod/master
[pull] master from diygod:master
2 parents 4b42edf + 322dd10 commit 89181d1

File tree

19 files changed

+346
-56
lines changed

19 files changed

+346
-56
lines changed

docs/en/other.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ Official Website: <https://news.yahoo.co.jp/pages/article/20200207>
126126

127127
<RouteEn author="LogicJake" example="/instapaper/person/viridiano" path="/instapaper/person"/>
128128

129+
## Instructables
130+
131+
### Projects
132+
133+
<RouteEn author="wolfg1969" example="/instructables/projects/circuits" path="/instructables/projects/:category?" :paramsDesc="['Category, empty by default, can be found in URL or see the table below']" radar="1">
134+
135+
| All | Circuits | Workshop | Craft | Cooking | Living | Outside | Teachers |
136+
| --- | -------- | -------- | ----- | ------- | ------ | ------- | -------- |
137+
| | circuits | workshop | craft | cooking | living | outside | teachers |
138+
139+
</RouteEn>
140+
129141
## Japanpost
130142

131143
### Track & Trace Service

docs/other.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ pageClass: routes
157157

158158
<Route author="LogicJake" example="/instapaper/person/viridiano" path="/instapaper/person"/>
159159

160+
## Instructables
161+
162+
### Projects
163+
164+
<Route author="wolfg1969" example="/instructables/projects/circuits" path="/instructables/projects/:category?" :paramsDesc="['项目类别。默认空值为全部,从网页地址中得知,见下表']" radar="1">
165+
166+
| All | Circuits | Workshop | Craft | Cooking | Living | Outside | Teachers |
167+
| --- | -------- | -------- | ----- | ------- | ------ | ------- | -------- |
168+
| | circuits | workshop | craft | cooking | living | outside | teachers |
169+
170+
</Route>
171+
160172
## iYouport
161173

162174
### 首页(旧版)

docs/university.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,16 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
16501650

16511651
</Route>
16521652

1653+
## 江苏海洋大学
1654+
1655+
### 官网通知公告
1656+
1657+
<Route author="real-jiakai" example="/jou/tzgg" path="/jou/tzgg" radar="1" />
1658+
1659+
### 研招网通知公告
1660+
1661+
<Route author="real-jiakai" example="/jou/yztzgg" path="/jou/yztzgg" radar="1" />
1662+
16531663
## 井冈山大学
16541664

16551665
### 教务处通知
@@ -2031,7 +2041,11 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
20312041

20322042
### 官网通知公告
20332043

2034-
<Route author="real-jiakai" example="/njxzc/tzgg" path="/njxzc/tzgg" radar="1"/>
2044+
<Route author="real-jiakai" example="/njxzc/tzgg" path="/njxzc/tzgg" radar="1" />
2045+
2046+
### 图书馆通知公告
2047+
2048+
<Route author="real-jiakai" example="/njxzc/libtzgg" path="/njxzc/libtzgg" radar="1" />
20352049

20362050
## 南京信息工程大学
20372051

lib/v2/instructables/maintainer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'/projects/:category?': ['wolfg1969'],
3+
};

lib/v2/instructables/projects.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const got = require('@/utils/got');
2+
3+
module.exports = async (ctx) => {
4+
const category = ctx.params.category ?? 'all';
5+
6+
const siteDomain = 'www.instructables.com';
7+
const apiKey = 'NU5CdGwyRDdMVnVmM3l4cWNqQzFSVzJNZU5jaUxFU3dGK3J2L203MkVmVT02ZWFYeyJleGNsdWRlX2ZpZWxkcyI6WyJvdXRfb2YiLCJzZWFyY2hfdGltZV9tcyIsInN0ZXBCb2R5Il0sInBlcl9wYWdlIjo1MH0=';
8+
9+
let pathPrefix, projectFilter;
10+
if (category === 'all') {
11+
pathPrefix = '';
12+
projectFilter = '';
13+
} else {
14+
pathPrefix = `${category}/`;
15+
const filterValue = `${category.charAt(0).toUpperCase()}${category.slice(1)}`;
16+
projectFilter = category !== 'teachers' ? ` && category:=${filterValue}` : `&& teachers:=${filterValue}`;
17+
}
18+
19+
const link = `https://${siteDomain}/${pathPrefix}projects?projects=all`;
20+
21+
const response = await got({
22+
method: 'get',
23+
url: `https://${siteDomain}/api_proxy/search/collections/projects/documents/search`,
24+
headers: {
25+
Referer: link,
26+
Host: siteDomain,
27+
'x-typesense-api-key': apiKey,
28+
},
29+
searchParams: {
30+
q: '*',
31+
query_by: 'title,stepBody,screenName',
32+
page: 1,
33+
per_page: 50,
34+
sort_by: 'publishDate:desc',
35+
include_fields: 'title,urlString,coverImageUrl,screenName,publishDate,favorites,views,primaryClassification,featureFlag,prizeLevel,IMadeItCount',
36+
filter_by: `featureFlag:=true${projectFilter}`,
37+
},
38+
});
39+
40+
const data = response.data;
41+
42+
ctx.state.data = {
43+
title: 'Instructables Projects', // 项目的标题
44+
link, // 指向项目的链接
45+
description: 'Instructables Projects', // 描述项目
46+
language: 'en', // 频道语言
47+
item: data.hits.map((item) => ({
48+
title: item.document.title,
49+
link: `https://${siteDomain}/${item.document.urlString}`,
50+
author: item.document.screenName,
51+
pubDate: new Date(item.document.publishDate).toUTCString(),
52+
category: item.document.primaryClassification,
53+
})),
54+
};
55+
};

lib/v2/instructables/radar.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
'instructables.com': {
3+
_name: 'Instructables',
4+
'.': [
5+
{
6+
title: 'All Projects - Instructables',
7+
docs: 'https://docs.rsshub.app/other.html#instructables',
8+
source: ['/projects'],
9+
target: '/instructables/projects',
10+
},
11+
{
12+
title: 'Projects - Instructables',
13+
docs: 'https://docs.rsshub.app/other.html#instructables',
14+
source: ['/:category/projects'],
15+
target: (params) => `/instructables/projects/${params.category}`,
16+
},
17+
],
18+
},
19+
};

lib/v2/instructables/router.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = (router) => {
2+
router.get('/projects/:category?', require('./projects'));
3+
};

lib/v2/jou/home.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { getItems } = require('./utils');
2+
3+
const url = 'https://www.jou.edu.cn/index/tzgg.htm';
4+
const host = 'https://www.jou.edu.cn';
5+
6+
module.exports = async (ctx) => {
7+
const out = await getItems(ctx, url, host, 'winstyle106390', 'timestyle106390', 'titlestyle106402', 'timestyle106402');
8+
9+
// 生成RSS源
10+
ctx.state.data = {
11+
// 项目标题
12+
title: '江苏海洋大学 -- 通知公告',
13+
// 项目链接
14+
link: url,
15+
// items的内容
16+
item: out,
17+
};
18+
};

lib/v2/jou/maintainer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
'/tzgg': ['real-jiakai'],
3+
'/yztzgg': ['real-jiakai'],
4+
};

lib/v2/jou/radar.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
'jou.edu.cn': {
3+
_name: '江苏海洋大学',
4+
www: [
5+
{
6+
title: '通知公告',
7+
docs: 'https://docs.rsshub.app/university.html#jiang-su-hai-yang-da-xue-guan-wang-tong-zhi-gong-gao',
8+
source: ['/index/tzgg.htm', '/'],
9+
target: '/jou/tzgg',
10+
},
11+
],
12+
yz: [
13+
{
14+
title: '研招通知公告',
15+
docs: 'https://docs.rsshub.app/university.html#jiang-su-hai-yang-da-xue-yan-zhao-wang-tong-zhi-gong-gao',
16+
source: ['/index/zxgg.htm', '/'],
17+
target: '/jou/yztzgg',
18+
},
19+
],
20+
},
21+
};

0 commit comments

Comments
 (0)