rsshub 1.0.0-master.bec0e6d → 1.0.0-master.bed0ab8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.ts +6 -0
- package/lib/routes/591/list.ts +4 -4
- package/lib/routes/apple/apps.ts +4 -4
- package/lib/routes/bsky/posts.ts +6 -6
- package/lib/routes/caixin/blog.ts +2 -2
- package/lib/routes/caixin/latest.ts +2 -2
- package/lib/routes/cebbank/all.ts +3 -4
- package/lib/routes/cebbank/history.ts +4 -7
- package/lib/routes/cngal/entry.ts +1 -1
- package/lib/routes/dahecube/index.ts +3 -7
- package/lib/routes/dcfever/news.ts +14 -19
- package/lib/routes/dcfever/reviews.ts +7 -15
- package/lib/routes/dcfever/trading-search.ts +11 -22
- package/lib/routes/dcfever/trading.ts +10 -21
- package/lib/routes/dcfever/utils.ts +10 -9
- package/lib/routes/deepin/homepage.ts +41 -0
- package/lib/routes/deepin/namespace.ts +9 -0
- package/lib/routes/eprice/rss.ts +3 -9
- package/lib/routes/esquirehk/namespace.ts +6 -0
- package/lib/routes/esquirehk/tag.ts +104 -0
- package/lib/routes/esquirehk/templates/subpages.art +30 -0
- package/lib/routes/gamer/hot.ts +3 -6
- package/lib/routes/github/comments.ts +12 -14
- package/lib/routes/github/notifications.ts +6 -6
- package/lib/routes/gitpod/blog.ts +3 -8
- package/lib/routes/hkej/index.ts +3 -6
- package/lib/routes/hket/index.ts +3 -8
- package/lib/routes/javdb/actors.ts +7 -2
- package/lib/routes/javdb/makers.ts +7 -1
- package/lib/routes/javdb/rankings.ts +7 -1
- package/lib/routes/javdb/search.ts +7 -1
- package/lib/routes/javdb/series.ts +7 -1
- package/lib/routes/javdb/tags.ts +7 -1
- package/lib/routes/javdb/utils.ts +16 -0
- package/lib/routes/luolei/index.ts +28 -4
- package/lib/routes/luolei/templates/description.art +19 -0
- package/lib/routes/macupdate/app.ts +4 -4
- package/lib/routes/nature/siteindex.ts +3 -3
- package/lib/routes/nintendo/eshop-us.ts +1 -1
- package/lib/routes/otobanana/cast.ts +5 -5
- package/lib/routes/otobanana/livestream.ts +5 -5
- package/lib/routes/otobanana/timeline.ts +5 -5
- package/lib/routes/qbittorrent/news.ts +3 -6
- package/lib/routes/taptap/review.ts +3 -7
- package/lib/routes/taptap/topic.ts +3 -5
- package/lib/routes/threads/utils.ts +3 -2
- package/lib/routes/timednews/news.ts +3 -7
- package/lib/routes/wechat/feeddd.ts +3 -9
- package/lib/routes/wechat/tgchannel.ts +1 -1
- package/lib/routes/wordpress/index.ts +172 -0
- package/lib/routes/wordpress/namespace.ts +8 -0
- package/lib/routes/wordpress/util.ts +307 -0
- package/lib/routes/xjtu/dean.ts +22 -23
- package/lib/routes/youtube/subscriptions.ts +3 -4
- package/lib/routes/zhubai/index.ts +2 -2
- package/lib/utils/got.test.ts +17 -0
- package/lib/utils/got.ts +11 -0
- package/package.json +9 -9
- package/lib/routes-deprecated/blogs/wordpress.js +0 -50
package/lib/config.ts
CHANGED
|
@@ -166,6 +166,9 @@ export type Config = {
|
|
|
166
166
|
username?: string;
|
|
167
167
|
password?: string;
|
|
168
168
|
};
|
|
169
|
+
javdb: {
|
|
170
|
+
session?: string;
|
|
171
|
+
};
|
|
169
172
|
lastfm: {
|
|
170
173
|
api_key?: string;
|
|
171
174
|
};
|
|
@@ -508,6 +511,9 @@ const calculateValue = () => {
|
|
|
508
511
|
username: envs.IWARA_USERNAME,
|
|
509
512
|
password: envs.IWARA_PASSWORD,
|
|
510
513
|
},
|
|
514
|
+
javdb: {
|
|
515
|
+
session: envs.JAVDB_SESSION,
|
|
516
|
+
},
|
|
511
517
|
lastfm: {
|
|
512
518
|
api_key: envs.LASTFM_API_KEY,
|
|
513
519
|
},
|
package/lib/routes/591/list.ts
CHANGED
|
@@ -157,14 +157,14 @@ async function handler(ctx) {
|
|
|
157
157
|
};
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
+
ctx.set('json', {
|
|
161
|
+
houses,
|
|
162
|
+
});
|
|
163
|
+
|
|
160
164
|
return {
|
|
161
165
|
title: '591 租屋 - 自訂查詢',
|
|
162
166
|
link: queryUrl,
|
|
163
167
|
description: `591 租屋 - 自訂查詢, query: ${query}`,
|
|
164
168
|
item: items,
|
|
165
169
|
};
|
|
166
|
-
|
|
167
|
-
ctx.set('json', {
|
|
168
|
-
houses,
|
|
169
|
-
});
|
|
170
170
|
}
|
package/lib/routes/apple/apps.ts
CHANGED
|
@@ -117,6 +117,10 @@ async function handler(ctx) {
|
|
|
117
117
|
|
|
118
118
|
const icon = new URL('favicon.ico', rootUrl).href;
|
|
119
119
|
|
|
120
|
+
ctx.set('json', {
|
|
121
|
+
appData,
|
|
122
|
+
});
|
|
123
|
+
|
|
120
124
|
return {
|
|
121
125
|
item: items,
|
|
122
126
|
title: `${title} - Apple App Stroe`,
|
|
@@ -130,8 +134,4 @@ async function handler(ctx) {
|
|
|
130
134
|
author: artistName,
|
|
131
135
|
allowEmpty: true,
|
|
132
136
|
};
|
|
133
|
-
|
|
134
|
-
ctx.set('json', {
|
|
135
|
-
appData,
|
|
136
|
-
});
|
|
137
137
|
}
|
package/lib/routes/bsky/posts.ts
CHANGED
|
@@ -52,6 +52,12 @@ async function handler(ctx) {
|
|
|
52
52
|
comments: post.replyCount,
|
|
53
53
|
}));
|
|
54
54
|
|
|
55
|
+
ctx.set('json', {
|
|
56
|
+
DID,
|
|
57
|
+
profile,
|
|
58
|
+
authorFeed,
|
|
59
|
+
});
|
|
60
|
+
|
|
55
61
|
return {
|
|
56
62
|
title: `${profile.displayName} (@${profile.handle}) — Bluesky`,
|
|
57
63
|
description: profile.description?.replaceAll('\n', ' '),
|
|
@@ -61,10 +67,4 @@ async function handler(ctx) {
|
|
|
61
67
|
logo: profile.avatar,
|
|
62
68
|
item: items,
|
|
63
69
|
};
|
|
64
|
-
|
|
65
|
-
ctx.set('json', {
|
|
66
|
-
DID,
|
|
67
|
-
profile,
|
|
68
|
-
authorFeed,
|
|
69
|
-
});
|
|
70
70
|
}
|
|
@@ -34,9 +34,9 @@ export const route: Route = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
async function handler() {
|
|
37
|
-
const { data } = await got('https://gateway.caixin.com/api/dataplatform/scroll/index')
|
|
37
|
+
const { data } = await got('https://gateway.caixin.com/api/dataplatform/scroll/index');
|
|
38
38
|
|
|
39
|
-
const list = data.articleList
|
|
39
|
+
const list = data.data.articleList
|
|
40
40
|
.map((e) => ({
|
|
41
41
|
title: e.title,
|
|
42
42
|
link: e.url,
|
|
@@ -63,7 +63,7 @@ async function handler(ctx) {
|
|
|
63
63
|
})
|
|
64
64
|
.get();
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
const ret = {
|
|
67
67
|
title: '中国光大银行',
|
|
68
68
|
description: '中国光大银行 外汇牌价',
|
|
69
69
|
link,
|
|
@@ -71,9 +71,8 @@ async function handler(ctx) {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
ctx.set('json', {
|
|
74
|
-
|
|
75
|
-
description: '中国光大银行 外汇牌价',
|
|
74
|
+
...ret,
|
|
76
75
|
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 0),
|
|
77
|
-
item: items,
|
|
78
76
|
});
|
|
77
|
+
return ret;
|
|
79
78
|
}
|
|
@@ -65,16 +65,13 @@ async function handler(ctx) {
|
|
|
65
65
|
})
|
|
66
66
|
.get();
|
|
67
67
|
items.pop();
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
const ret = {
|
|
69
70
|
title: '中国光大银行',
|
|
70
71
|
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
|
|
71
72
|
link: `https://www.cebbank.com/site/ygzx/whpj/rmbwhpjlspj/index.html?currcode=${TYPE[type].id}`,
|
|
72
73
|
item: items,
|
|
73
74
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
title: '中国光大银行',
|
|
77
|
-
description: `中国光大银行 外汇牌价 ${TYPE[type].name}`,
|
|
78
|
-
item: items,
|
|
79
|
-
});
|
|
75
|
+
ctx.set('json', ret);
|
|
76
|
+
return ret;
|
|
80
77
|
}
|
|
@@ -38,6 +38,7 @@ async function handler(ctx) {
|
|
|
38
38
|
|
|
39
39
|
const data = response.data;
|
|
40
40
|
|
|
41
|
+
ctx.set('json', response.data);
|
|
41
42
|
return {
|
|
42
43
|
title: `CnGal - ${data.name} 的动态`,
|
|
43
44
|
link: `https://www.cngal.org/entries/index/${entryId}`,
|
|
@@ -48,5 +49,4 @@ async function handler(ctx) {
|
|
|
48
49
|
link: item.link,
|
|
49
50
|
})),
|
|
50
51
|
};
|
|
51
|
-
ctx.set('json', response.data);
|
|
52
52
|
}
|
|
@@ -72,7 +72,7 @@ async function handler(ctx) {
|
|
|
72
72
|
)
|
|
73
73
|
);
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const ret = {
|
|
76
76
|
title: '大河财立方',
|
|
77
77
|
link: parseUrl(type),
|
|
78
78
|
description: `大河财立方 ${TYPE[type].name}`,
|
|
@@ -80,10 +80,6 @@ async function handler(ctx) {
|
|
|
80
80
|
item: items,
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
ctx.set('json',
|
|
84
|
-
|
|
85
|
-
link: parseUrl(type),
|
|
86
|
-
description: `大河财立方 ${TYPE[type].name}`,
|
|
87
|
-
items,
|
|
88
|
-
});
|
|
83
|
+
ctx.set('json', ret);
|
|
84
|
+
return ret;
|
|
89
85
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
3
|
-
import got from '@/utils/got';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
4
3
|
import { load } from 'cheerio';
|
|
5
4
|
import { baseUrl, parseItem } from './utils';
|
|
6
5
|
|
|
@@ -9,17 +8,15 @@ export const route: Route = {
|
|
|
9
8
|
categories: ['new-media'],
|
|
10
9
|
example: '/dcfever/news',
|
|
11
10
|
parameters: { type: '分類,預設為所有新聞' },
|
|
12
|
-
features: {
|
|
13
|
-
requireConfig: false,
|
|
14
|
-
requirePuppeteer: false,
|
|
15
|
-
antiCrawler: false,
|
|
16
|
-
supportBT: false,
|
|
17
|
-
supportPodcast: false,
|
|
18
|
-
supportScihub: false,
|
|
19
|
-
},
|
|
20
11
|
name: '新聞中心',
|
|
21
12
|
maintainers: ['TonyRL'],
|
|
22
13
|
handler,
|
|
14
|
+
radar: [
|
|
15
|
+
{
|
|
16
|
+
source: ['dcfever.com/news/index.php'],
|
|
17
|
+
target: '/news',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
23
20
|
description: `| 所有新聞 | 攝影器材 | 手機通訊 | 汽車熱話 | 攝影文化 | 影片攝錄 | 測試報告 | 生活科技 | 攝影技巧 |
|
|
24
21
|
| -------- | -------- | -------- | -------- | ----------- | ----------- | -------- | -------- | --------- |
|
|
25
22
|
| | camera | mobile | auto | photography | videography | reviews | gadget | technique |`,
|
|
@@ -28,12 +25,10 @@ export const route: Route = {
|
|
|
28
25
|
async function handler(ctx) {
|
|
29
26
|
const type = ctx.req.param('type');
|
|
30
27
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
const $ = load(response.data);
|
|
28
|
+
const link = new URL(`${baseUrl}/news/index.php`, baseUrl);
|
|
29
|
+
link.searchParams.append('type', type);
|
|
30
|
+
const response = await ofetch(link.href);
|
|
31
|
+
const $ = load(response);
|
|
37
32
|
|
|
38
33
|
const list = $('.col-md-left .title a')
|
|
39
34
|
.toArray()
|
|
@@ -41,18 +36,18 @@ async function handler(ctx) {
|
|
|
41
36
|
item = $(item);
|
|
42
37
|
return {
|
|
43
38
|
title: item.text(),
|
|
44
|
-
link: new URL(item.attr('href'),
|
|
39
|
+
link: new URL(item.attr('href'), link.href).href,
|
|
45
40
|
};
|
|
46
41
|
});
|
|
47
42
|
|
|
48
|
-
const items = await Promise.all(list.map((item) => parseItem(item
|
|
43
|
+
const items = await Promise.all(list.map((item) => parseItem(item)));
|
|
49
44
|
|
|
50
45
|
return {
|
|
51
46
|
title: `${$('.channel_nav')
|
|
52
47
|
.contents()
|
|
53
48
|
.filter((_, e) => e.nodeType === 3)
|
|
54
49
|
.text()} - ${$('head title').text()}`,
|
|
55
|
-
link:
|
|
50
|
+
link: link.href,
|
|
56
51
|
image: 'https://cdn10.dcfever.com/images/android_192.png',
|
|
57
52
|
item: items,
|
|
58
53
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
3
|
-
import got from '@/utils/got';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
4
3
|
import { load } from 'cheerio';
|
|
5
4
|
import { baseUrl, parseItem } from './utils';
|
|
6
5
|
|
|
@@ -9,14 +8,6 @@ export const route: Route = {
|
|
|
9
8
|
categories: ['new-media'],
|
|
10
9
|
example: '/dcfever/reviews/cameras',
|
|
11
10
|
parameters: { type: '分類,預設為 `cameras`' },
|
|
12
|
-
features: {
|
|
13
|
-
requireConfig: false,
|
|
14
|
-
requirePuppeteer: false,
|
|
15
|
-
antiCrawler: false,
|
|
16
|
-
supportBT: false,
|
|
17
|
-
supportPodcast: false,
|
|
18
|
-
supportScihub: false,
|
|
19
|
-
},
|
|
20
11
|
radar: [
|
|
21
12
|
{
|
|
22
13
|
source: ['dcfever.com/:type/reviews.php'],
|
|
@@ -34,8 +25,9 @@ export const route: Route = {
|
|
|
34
25
|
async function handler(ctx) {
|
|
35
26
|
const { type = 'cameras' } = ctx.req.param();
|
|
36
27
|
|
|
37
|
-
const
|
|
38
|
-
const
|
|
28
|
+
const link = `${baseUrl}/${type}/reviews.php`;
|
|
29
|
+
const response = await ofetch(link);
|
|
30
|
+
const $ = load(response);
|
|
39
31
|
|
|
40
32
|
const list = $('.col-md-left .title a')
|
|
41
33
|
.toArray()
|
|
@@ -43,15 +35,15 @@ async function handler(ctx) {
|
|
|
43
35
|
item = $(item);
|
|
44
36
|
return {
|
|
45
37
|
title: item.text(),
|
|
46
|
-
link: new URL(item.attr('href'),
|
|
38
|
+
link: new URL(item.attr('href'), link).href,
|
|
47
39
|
};
|
|
48
40
|
});
|
|
49
41
|
|
|
50
|
-
const items = await Promise.all(list.map((item) => parseItem(item
|
|
42
|
+
const items = await Promise.all(list.map((item) => parseItem(item)));
|
|
51
43
|
|
|
52
44
|
return {
|
|
53
45
|
title: $('head title').text(),
|
|
54
|
-
link
|
|
46
|
+
link,
|
|
55
47
|
image: 'https://cdn10.dcfever.com/images/android_192.png',
|
|
56
48
|
item: items,
|
|
57
49
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
3
|
-
import got from '@/utils/got';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
4
3
|
import { load } from 'cheerio';
|
|
5
4
|
// import { parseRelativeDate } from '@/utils/parse-date';
|
|
6
5
|
import { baseUrl, parseTradeItem } from './utils';
|
|
@@ -10,14 +9,6 @@ export const route: Route = {
|
|
|
10
9
|
categories: ['new-media'],
|
|
11
10
|
example: '/dcfever/trading/search/Sony',
|
|
12
11
|
parameters: { keyword: '關鍵字', mainCat: '主要分類 ID,見上表' },
|
|
13
|
-
features: {
|
|
14
|
-
requireConfig: false,
|
|
15
|
-
requirePuppeteer: false,
|
|
16
|
-
antiCrawler: false,
|
|
17
|
-
supportBT: false,
|
|
18
|
-
supportPodcast: false,
|
|
19
|
-
supportScihub: false,
|
|
20
|
-
},
|
|
21
12
|
name: '二手市集 - 物品搜尋',
|
|
22
13
|
maintainers: ['TonyRL'],
|
|
23
14
|
handler,
|
|
@@ -26,15 +17,13 @@ export const route: Route = {
|
|
|
26
17
|
async function handler(ctx) {
|
|
27
18
|
const { keyword, mainCat } = ctx.req.param();
|
|
28
19
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
const $ = load(response.data);
|
|
20
|
+
const link = new URL(`${baseUrl}/trading/search.php`, baseUrl);
|
|
21
|
+
link.searchParams.append('keyword', keyword);
|
|
22
|
+
link.searchParams.append('type', 'all');
|
|
23
|
+
mainCat && link.searchParams.append('main_cat', mainCat);
|
|
24
|
+
link.searchParams.append('form_action', 'search_action');
|
|
25
|
+
const response = await ofetch(link.href);
|
|
26
|
+
const $ = load(response);
|
|
38
27
|
|
|
39
28
|
const list = $('.item_list li a')
|
|
40
29
|
.toArray()
|
|
@@ -43,16 +32,16 @@ async function handler(ctx) {
|
|
|
43
32
|
item.find('.optional').remove();
|
|
44
33
|
return {
|
|
45
34
|
title: item.find('.trade_title').text(),
|
|
46
|
-
link: new URL(item.attr('href'),
|
|
35
|
+
link: new URL(item.attr('href'), link.href).href,
|
|
47
36
|
author: item.find('.trade_info').text(),
|
|
48
37
|
};
|
|
49
38
|
});
|
|
50
39
|
|
|
51
|
-
const items = await Promise.all(list.map((item) => parseTradeItem(item
|
|
40
|
+
const items = await Promise.all(list.map((item) => parseTradeItem(item)));
|
|
52
41
|
|
|
53
42
|
return {
|
|
54
43
|
title: $('head title').text(),
|
|
55
|
-
link:
|
|
44
|
+
link: link.href,
|
|
56
45
|
image: 'https://cdn10.dcfever.com/images/android_192.png',
|
|
57
46
|
item: items,
|
|
58
47
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
3
|
-
import got from '@/utils/got';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
4
3
|
import { load } from 'cheerio';
|
|
5
4
|
// import { parseRelativeDate } from '@/utils/parse-date';
|
|
6
5
|
import { baseUrl, parseTradeItem } from './utils';
|
|
@@ -10,14 +9,6 @@ export const route: Route = {
|
|
|
10
9
|
categories: ['new-media'],
|
|
11
10
|
example: '/dcfever/trading/1',
|
|
12
11
|
parameters: { id: '分類 ID,見下表' },
|
|
13
|
-
features: {
|
|
14
|
-
requireConfig: false,
|
|
15
|
-
requirePuppeteer: false,
|
|
16
|
-
antiCrawler: false,
|
|
17
|
-
supportBT: false,
|
|
18
|
-
supportPodcast: false,
|
|
19
|
-
supportScihub: false,
|
|
20
|
-
},
|
|
21
12
|
name: '二手市集',
|
|
22
13
|
maintainers: ['TonyRL'],
|
|
23
14
|
handler,
|
|
@@ -31,14 +22,12 @@ export const route: Route = {
|
|
|
31
22
|
async function handler(ctx) {
|
|
32
23
|
const { id, order = 'new' } = ctx.req.param();
|
|
33
24
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
const $ = load(response.data);
|
|
25
|
+
const link = new URL(`${baseUrl}/trading/listing.php`, baseUrl);
|
|
26
|
+
link.searchParams.append('id', id);
|
|
27
|
+
link.searchParams.append('order', order);
|
|
28
|
+
link.searchParams.append('type', 'all');
|
|
29
|
+
const response = await ofetch(link.href);
|
|
30
|
+
const $ = load(response);
|
|
42
31
|
|
|
43
32
|
const list = $('.item_list li a')
|
|
44
33
|
.toArray()
|
|
@@ -48,16 +37,16 @@ async function handler(ctx) {
|
|
|
48
37
|
item.find('.optional').remove();
|
|
49
38
|
return {
|
|
50
39
|
title: item.find('.trade_title').text(),
|
|
51
|
-
link: new URL(item.attr('href'),
|
|
40
|
+
link: new URL(item.attr('href'), link.href).href,
|
|
52
41
|
author: item.find('.trade_info').text(),
|
|
53
42
|
};
|
|
54
43
|
});
|
|
55
44
|
|
|
56
|
-
const items = await Promise.all(list.map((item) => parseTradeItem(item
|
|
45
|
+
const items = await Promise.all(list.map((item) => parseTradeItem(item)));
|
|
57
46
|
|
|
58
47
|
return {
|
|
59
48
|
title: $('head title').text(),
|
|
60
|
-
link:
|
|
49
|
+
link: link.href,
|
|
61
50
|
image: 'https://cdn10.dcfever.com/images/android_192.png',
|
|
62
51
|
item: items,
|
|
63
52
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { getCurrentPath } from '@/utils/helpers';
|
|
2
2
|
const __dirname = getCurrentPath(import.meta.url);
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import ofetch from '@/utils/ofetch';
|
|
5
5
|
import { load } from 'cheerio';
|
|
6
6
|
import { parseDate } from '@/utils/parse-date';
|
|
7
7
|
import { art } from '@/utils/render';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
+
import cache from '@/utils/cache';
|
|
9
10
|
|
|
10
11
|
const baseUrl = 'https://www.dcfever.com';
|
|
11
12
|
|
|
12
|
-
const parseItem = (item
|
|
13
|
-
tryGet(item.link, async () => {
|
|
14
|
-
const
|
|
13
|
+
const parseItem = (item) =>
|
|
14
|
+
cache.tryGet(item.link, async () => {
|
|
15
|
+
const response = await ofetch(item.link);
|
|
15
16
|
const $ = load(response);
|
|
16
17
|
const content = $('div[itemprop="articleBody"], .column_article_content_html');
|
|
17
18
|
|
|
@@ -23,7 +24,7 @@ const parseItem = (item, tryGet) =>
|
|
|
23
24
|
if (pageLinks.length) {
|
|
24
25
|
const pages = await Promise.all(
|
|
25
26
|
pageLinks.map(async (pageLink) => {
|
|
26
|
-
const
|
|
27
|
+
const response = await ofetch(pageLink.link);
|
|
27
28
|
const $ = load(response);
|
|
28
29
|
return $('div[itemprop="articleBody"]').html();
|
|
29
30
|
})
|
|
@@ -32,7 +33,7 @@ const parseItem = (item, tryGet) =>
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
content.find('img').each((_, e) => {
|
|
35
|
-
if (e.attribs.src
|
|
36
|
+
if (e.attribs.src?.includes('?')) {
|
|
36
37
|
e.attribs.src = e.attribs.src.split('?')[0];
|
|
37
38
|
}
|
|
38
39
|
});
|
|
@@ -57,9 +58,9 @@ const parseItem = (item, tryGet) =>
|
|
|
57
58
|
return item;
|
|
58
59
|
});
|
|
59
60
|
|
|
60
|
-
const parseTradeItem = (item
|
|
61
|
-
tryGet(item.link, async () => {
|
|
62
|
-
const
|
|
61
|
+
const parseTradeItem = (item) =>
|
|
62
|
+
cache.tryGet(item.link, async () => {
|
|
63
|
+
const response = await ofetch(item.link);
|
|
63
64
|
const $ = load(response);
|
|
64
65
|
|
|
65
66
|
$('.selector_text').remove();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { parseDate } from '@/utils/parse-date';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/homepage/:user_id',
|
|
7
|
+
categories: ['bbs'],
|
|
8
|
+
example: '/deepin/homepage/78326',
|
|
9
|
+
parameters: { user_id: 'user id' },
|
|
10
|
+
name: 'BBS Home Page',
|
|
11
|
+
maintainers: ['tensor-tech'],
|
|
12
|
+
radar: {
|
|
13
|
+
source: ['bbs.deepin.org/user/:user_id'],
|
|
14
|
+
target: '/homepage/:user_id',
|
|
15
|
+
},
|
|
16
|
+
handler,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
async function handler(ctx) {
|
|
20
|
+
const { user_id } = ctx.req.param();
|
|
21
|
+
const res = await ofetch(`https://bbs.deepin.org/api/v1/user/thread?date_type=0&limit=10&offset=0&user_id=${user_id}`, {
|
|
22
|
+
headers: {
|
|
23
|
+
accept: 'application/json',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const items = res.data.map((item) => ({
|
|
28
|
+
title: item.subject,
|
|
29
|
+
link: `https://bbs.deepin.org/post/${item.id}`,
|
|
30
|
+
description: item.post.message,
|
|
31
|
+
pubDate: parseDate(item.created_at),
|
|
32
|
+
author: item.user.nickname,
|
|
33
|
+
category: item.forum.name,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
title: `${items[0].author}/deepin论坛主页`,
|
|
38
|
+
link: `https://bbs.deepin.org/user/${user_id}`,
|
|
39
|
+
item: items,
|
|
40
|
+
};
|
|
41
|
+
}
|
package/lib/routes/eprice/rss.ts
CHANGED
|
@@ -108,7 +108,7 @@ async function handler(ctx) {
|
|
|
108
108
|
)
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
const ret = {
|
|
112
112
|
title: feed.title,
|
|
113
113
|
link: feed.link,
|
|
114
114
|
description: feed.description,
|
|
@@ -117,12 +117,6 @@ async function handler(ctx) {
|
|
|
117
117
|
language: feed.language,
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
ctx.set('json',
|
|
121
|
-
|
|
122
|
-
link: feed.link,
|
|
123
|
-
description: feed.description,
|
|
124
|
-
item: items,
|
|
125
|
-
image: feed.image.url,
|
|
126
|
-
language: feed.language,
|
|
127
|
-
});
|
|
120
|
+
ctx.set('json', ret);
|
|
121
|
+
return ret;
|
|
128
122
|
}
|