Skip to content

Commit 01af97c

Browse files
authored
Merge pull request #2307 from DIYgod/master
[pull] master from diygod:master
2 parents 9f75903 + aea213e commit 01af97c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+420
-38
lines changed

lib/v2/1point3acres/maintainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = {
22
'/blog/:category?': ['nczitzk'],
33
'/category/:id?/:type?/:order?': ['nczitzk'],
4-
'/offer/:year?/:major?/:school?': ['NavePnow'],
5-
'/post/:type?/:order?': ['NavePnow', 'DIYgod', 'nczitzk'],
4+
'/offer/:year?/:major?/:school?': ['EthanWng97'],
5+
'/post/:type?/:order?': ['EthanWng97', 'DIYgod', 'nczitzk'],
66
'/section/:id?/:type?/:order?': ['nczitzk'],
77
'/user/:id/posts': ['Maecenas'],
88
'/user/:id/threads': ['Maecenas'],

lib/v2/amazon/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
'/awsblogs/:locale?': ['HankChow'],
3-
'/kindle/software-updates': ['NavePnow'],
3+
'/kindle/software-updates': ['EthanWng97'],
44
};

lib/v2/arcteryx/maintainer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
'/new-arrivals/:country/:gender': ['NavePnow'],
3-
'/outlet/:country/:gender': ['NavePnow'],
4-
'/regear/new-arrivals': ['NavePnow'],
2+
'/new-arrivals/:country/:gender': ['EthanWng97'],
3+
'/outlet/:country/:gender': ['EthanWng97'],
4+
'/regear/new-arrivals': ['EthanWng97'],
55
};

lib/v2/bellroy/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
'/new-releases': ['NavePnow'],
2+
'/new-releases': ['EthanWng97'],
33
};

lib/v2/gov/maintainer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ module.exports = {
4949
'/pbc/tradeAnnouncement': ['nczitzk'],
5050
'/pbc/zcyj': ['Fatpandac'],
5151
'/samr/xgzlyhd/:category?/:department?': ['nczitzk'],
52+
'/safe/bussiness/:site?': ['nczitzk'],
53+
'/safe/complaint/:site?': ['nczitzk'],
5254
'/sasac/:path+': ['TonyRL'],
5355
'/stats/:path+': ['bigfei', 'nczitzk'],
5456
'/zhengce/govall/:advance?': ['ciaranchen'],

lib/v2/gov/radar.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,31 @@ module.exports = {
11851185
},
11861186
],
11871187
},
1188+
'safe.gov.cn': {
1189+
_name: '国家外汇管理局',
1190+
'.': [
1191+
{
1192+
title: '业务咨询',
1193+
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-ye-wu-zi-xun',
1194+
source: ['/:site/ywzx/index.html'],
1195+
target: (params) => {
1196+
const site = params.site;
1197+
1198+
return `/gov/safe/business/${site}`;
1199+
},
1200+
},
1201+
{
1202+
title: '投诉建议',
1203+
docs: 'https://docs.rsshub.app/routes/government#guo-jia-wai-hui-guan-li-ju-tou-su-jian-yi',
1204+
source: ['/:site/tsjy/index.html'],
1205+
target: (params) => {
1206+
const site = params.site;
1207+
1208+
return `/gov/safe/complaint/${site}`;
1209+
},
1210+
},
1211+
],
1212+
},
11881213
'sasac.gov.cn': {
11891214
_name: '国务院国有资产监督管理委员会',
11901215
'.': [

lib/v2/gov/router.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module.exports = function (router) {
4141
router.get('/pbc/gzlw', require('./pbc/gzlw'));
4242
router.get('/pbc/tradeAnnouncement', require('./pbc/tradeAnnouncement'));
4343
router.get('/pbc/zcyj', require('./pbc/zcyj'));
44+
router.get('/safe/business/:site?', require('./safe/business'));
45+
router.get('/safe/complaint/:site?', require('./safe/complaint'));
4446
router.get('/samr/xgzlyhd/:category?/:department?', require('./samr/xgzlyhd'));
4547
router.get('/sasac/:path+', require('./sasac/generic'));
4648
router.get(/stats(\/[\w/-]+)?/, require('./stats'));

lib/v2/gov/safe/business.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { processZxfkItems } = require('./util');
2+
3+
module.exports = async (ctx) => {
4+
const { site = 'beijing' } = ctx.params;
5+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 3;
6+
7+
ctx.state.data = await processZxfkItems(site, 'ywzx', limit);
8+
};

lib/v2/gov/safe/complaint.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { processZxfkItems } = require('./util');
2+
3+
module.exports = async (ctx) => {
4+
const { site = 'beijing' } = ctx.params;
5+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
6+
7+
ctx.state.data = await processZxfkItems(site, 'tsjy', limit);
8+
};

lib/v2/gov/safe/templates/message.art

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<table>
2+
<tbody>
3+
<tr>
4+
<th>留言人</th>
5+
<th>留言内容</th>
6+
<th>留言时间</th>
7+
</tr>
8+
{{ if message }}
9+
{{ set object = message }}
10+
<tr>
11+
<td>{{ object.author }}</td>
12+
<td>{{ object.content }}</td>
13+
<td>{{ object.date }}</td>
14+
</tr>
15+
{{ /if }}
16+
{{ if reply }}
17+
{{ set object = reply }}
18+
<tr style="color: #0069ae;">
19+
<td>{{ object.author }}</td>
20+
<td>{{ object.content }}</td>
21+
<td>{{ object.date }}</td>
22+
</tr>
23+
{{ /if }}
24+
</tbody>
25+
</table>

lib/v2/gov/safe/util.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
const got = require('@/utils/got');
2+
const cheerio = require('cheerio');
3+
const { parseDate } = require('@/utils/parse-date');
4+
const { art } = require('@/utils/render');
5+
const path = require('path');
6+
7+
const rootUrl = 'https://www.safe.gov.cn';
8+
9+
const zxfkCategoryApis = {
10+
// 业务咨询 https://www.safe.gov.cn/<site>/ywzx/index.html
11+
ywzx: 'www/busines/businessQuery?siteid=',
12+
13+
// 投诉建议 https://www.safe.gov.cn/<site>/tsjy/index.html
14+
tsjy: 'www/complaint/complaintQuery?siteid=',
15+
};
16+
17+
const processZxfkItems = async (site = 'beijing', category = 'ywzx', limit = '3') => {
18+
const apiUrl = new URL(`${zxfkCategoryApis[category]}${site}`, rootUrl).href;
19+
const currentUrl = new URL(`${site}/${category}/index.html`, rootUrl).href;
20+
21+
const { data: response } = await got(apiUrl);
22+
23+
const $ = cheerio.load(response);
24+
25+
const items = $('#complaint')
26+
.slice(0, limit)
27+
.toArray()
28+
.map((item) => {
29+
item = $(item);
30+
31+
const spans = item.find('span[objid]');
32+
33+
const message = {
34+
author: spans.first().text().replace(/:$/, ''),
35+
content: spans.eq(1).text(),
36+
date: spans.eq(2).text(),
37+
};
38+
39+
const reply = {
40+
author: spans.eq(3).text().replace(/:$/, ''),
41+
content: spans.eq(4).text(),
42+
date: spans.eq(5).text(),
43+
};
44+
45+
return {
46+
title: `${message.author}: ${message.content}`,
47+
link: new URL(item.find('.title').prop('href'), rootUrl).href,
48+
description: art(path.join(__dirname, 'templates/message.art'), {
49+
message,
50+
reply,
51+
}),
52+
author: `${message.author}/${reply.author}`,
53+
guid: item.find('.id').text(),
54+
pubDate: parseDate(message.date),
55+
updated: parseDate(reply.date),
56+
};
57+
});
58+
59+
const { data: currentResponse } = await got(currentUrl);
60+
61+
const content = cheerio.load(currentResponse);
62+
63+
const author = content('meta[name="ColumnName"]').prop('content');
64+
const subtitle = content('meta[name="ColumnType"]').prop('content');
65+
66+
const imagePath = 'safe/templateresource/372b1dfdab204181b9b4f943a8e926a6';
67+
const image = new URL(`${imagePath}/logo_06.png`, rootUrl).href;
68+
const icon = new URL(`${imagePath}/safe.ico`, rootUrl).href;
69+
70+
return {
71+
item: items,
72+
title: `${author} - ${subtitle}`,
73+
link: currentUrl,
74+
description: content('meta[name="ColumnDescription"]').prop('content'),
75+
language: 'zh',
76+
image,
77+
icon,
78+
logo: icon,
79+
subtitle,
80+
author,
81+
allowEmpty: true,
82+
};
83+
};
84+
85+
module.exports = {
86+
processZxfkItems,
87+
};

lib/v2/ifi-audio/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
'/download/:val/:id': ['NavePnow'],
2+
'/download/:val/:id': ['EthanWng97'],
33
};

lib/v2/inoreader/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
'/html_clip/:user/:tag/:num?': ['BeautyyuYanli'],
3-
'/rss/:user/:tag': ['NavePnow'],
3+
'/rss/:user/:tag': ['EthanWng97'],
44
};

lib/v2/leetcode/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
'/articles': ['LogicJake'],
3-
'/dailyquestion/:lang': ['NavePnow'],
3+
'/dailyquestion/:lang': ['EthanWng97'],
44
'/dailyquestion/solution/:lang': ['woaidouya123'],
55
'/submission/:country/:user': ['NathanDai'],
66
};

lib/v2/magazinelib/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
'/latest-magazine/:query?': ['NavePnow'],
2+
'/latest-magazine/:query?': ['EthanWng97'],
33
};

lib/v2/missav/maintainer.js

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

lib/v2/missav/new.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const got = require('@/utils/got');
2+
const cheerio = require('cheerio');
3+
const { art } = require('@/utils/render');
4+
const { join } = require('path');
5+
6+
module.exports = async (ctx) => {
7+
const baseUrl = 'https://missav.com';
8+
const { data: response } = await got(`${baseUrl}/dm397/new`);
9+
const $ = cheerio.load(response);
10+
11+
const items = $('.grid .group')
12+
.toArray()
13+
.map((item) => {
14+
item = $(item);
15+
const title = item.find('.text-secondary');
16+
const poster = new URL(item.find('img').data('src'));
17+
poster.searchParams.set('class', 'normal');
18+
const video = item.find('video').data('src');
19+
return {
20+
title: title.text().trim(),
21+
link: title.attr('href'),
22+
description: art(join(__dirname, 'templates/preview.art'), {
23+
poster: poster.href,
24+
video,
25+
type: video.split('.').pop(),
26+
}),
27+
};
28+
});
29+
30+
ctx.state.data = {
31+
title: $('head title').text(),
32+
description: $('head meta[name="description"]').attr('content'),
33+
link: baseUrl,
34+
item: items,
35+
};
36+
};

lib/v2/missav/radar.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
'missav.com': {
3+
_name: 'MissAV.com',
4+
'.': [
5+
{
6+
title: '最近更新',
7+
docs: 'https://docs.rsshub.app/multimedia#missav-com',
8+
source: ['/dm397/new', '/new', '/'],
9+
target: '/missav/new',
10+
},
11+
],
12+
},
13+
};

lib/v2/missav/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('/new', require('./new'));
3+
};

lib/v2/missav/templates/preview.art

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<video controls preload="none" poster="{{ poster }}">
2+
<source src="{{ video }}" type="{{ type }}">
3+
</video>

lib/v2/ncu/radar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
'ncu.edu.cn': {
33
_name: '南昌大学',
4-
'.': [
4+
jwc: [
55
{
66
title: '教务通知',
77
docs: 'https://docs.rsshub.app/routes/university#nan-chang-da-xue',

lib/v2/patagonia/maintainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
'/patagonia/new-arrivals/:category': ['NavePnow'],
2+
'/patagonia/new-arrivals/:category': ['EthanWng97'],
33
};

lib/v2/routledge/book-series.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const got = require('@/utils/got');
2+
const cheerio = require('cheerio');
3+
const { parseDate } = require('@/utils/parse-date');
4+
const { art } = require('@/utils/render');
5+
const { join } = require('path');
6+
7+
module.exports = async (ctx) => {
8+
const { bookName, bookId } = ctx.params;
9+
const baseUrl = 'https://www.routledge.com';
10+
const pageUrl = `${baseUrl}/${bookName}/book-series/${bookId}`;
11+
const { data: response } = await got(pageUrl, {
12+
headers: {
13+
accept: 'text/html, */*; q=0.01',
14+
},
15+
searchParams: {
16+
publishedFilter: 'alltitles',
17+
pd: 'published,forthcoming',
18+
pg: 1,
19+
pp: 12,
20+
so: 'pub',
21+
view: 'list',
22+
},
23+
});
24+
const $ = cheerio.load(response);
25+
26+
const list = $('.row.book')
27+
.toArray()
28+
.map((item) => {
29+
item = $(item);
30+
const title = item.find('h3 a');
31+
const description = item.find('p.description');
32+
const meta = item.find('p.description').prev().text().split('\n');
33+
return {
34+
title: title.text(),
35+
link: title.attr('href'),
36+
description: description.text(),
37+
pubDate: parseDate(meta.pop().trim(), 'MMMM DD, YYYY'),
38+
author: meta
39+
.map((i) => i.trim())
40+
.filter((i) => i)
41+
.join(', '),
42+
};
43+
});
44+
45+
const items = await Promise.all(
46+
list.map((item) =>
47+
ctx.cache.tryGet(item.link, async () => {
48+
const { data } = await got(item.link);
49+
const $ = cheerio.load(data);
50+
const isbn = $('meta[property="books:isbn"]').attr('content');
51+
const { data: image } = await got('https://productimages.routledge.com', {
52+
searchParams: {
53+
isbn,
54+
size: 'amazon',
55+
ext: 'jpg',
56+
},
57+
});
58+
59+
const description = $('.sticky-div');
60+
description.find('button.accordion-button').contents().unwrap();
61+
description.find('.fa-shopping-cart').parent().parent().remove();
62+
63+
item.description = art(join(__dirname, 'templates/description.art'), {
64+
image,
65+
description: description.html(),
66+
});
67+
return item;
68+
})
69+
)
70+
);
71+
72+
ctx.state.data = {
73+
title: $('head title').text(),
74+
description: $('head meta[name="description"]').attr('content'),
75+
link: pageUrl,
76+
item: items,
77+
};
78+
};

lib/v2/routledge/maintainer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'/:bookName/book-series/:bookId': ['TonyRL'],
3+
};

0 commit comments

Comments
 (0)