rsshub 1.0.0-master.e4deee0 → 1.0.0-master.e4eedac

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.
Files changed (34) hide show
  1. package/lib/routes/aibase/news.ts +118 -0
  2. package/lib/routes/aibase/util.ts +3 -0
  3. package/lib/routes/bilibili/video.ts +1 -1
  4. package/lib/routes/cisia/index.ts +264 -0
  5. package/lib/routes/cisia/namespace.ts +8 -0
  6. package/lib/routes/cjlu/namespace.ts +10 -0
  7. package/lib/routes/cjlu/yjsy/index.ts +107 -0
  8. package/lib/routes/damai/activity.ts +3 -2
  9. package/lib/routes/famitsu/category.ts +1 -1
  10. package/lib/routes/hex-rays/index.ts +23 -29
  11. package/lib/routes/hfut/hf/notice.ts +43 -0
  12. package/lib/routes/hfut/hf/utils.ts +80 -0
  13. package/lib/routes/hfut/namespace.ts +6 -0
  14. package/lib/routes/hfut/xc/notice.ts +43 -0
  15. package/lib/routes/hfut/xc/utils.ts +73 -0
  16. package/lib/routes/hko/earthquake.ts +56 -0
  17. package/lib/routes/hko/namespace.ts +8 -0
  18. package/lib/routes/hko/weather.ts +56 -0
  19. package/lib/routes/papers/index.ts +7 -1
  20. package/lib/routes/parliament.uk/commonslibrary.ts +4 -4
  21. package/lib/routes/parliament.uk/lordslibrary.ts +4 -4
  22. package/lib/routes/picuki/profile.ts +50 -39
  23. package/lib/routes/rsshub/transform/html.ts +114 -75
  24. package/lib/routes/skeb/following-creators.ts +1 -1
  25. package/lib/routes/skeb/following-works.ts +1 -1
  26. package/lib/routes/skeb/friend-works.ts +1 -1
  27. package/lib/routes/skeb/index.ts +2 -2
  28. package/lib/routes/skeb/search.ts +1 -1
  29. package/lib/routes/skeb/works.ts +1 -1
  30. package/lib/routes/twitter/api/web-api/utils.ts +5 -3
  31. package/lib/routes/weibo/user.ts +1 -1
  32. package/lib/routes/zaobao/util.ts +41 -43
  33. package/package.json +8 -8
  34. package/lib/routes-deprecated/hko/weather.js +0 -44
@@ -0,0 +1,118 @@
1
+ import { Route } from '@/types';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { parseDate } from '@/utils/parse-date';
4
+ import { load } from 'cheerio';
5
+ import { rootUrl, buildApiUrl } from './util';
6
+
7
+ export const route: Route = {
8
+ path: '/news',
9
+ name: '资讯',
10
+ url: 'www.aibase.com',
11
+ maintainers: ['zreo0'],
12
+ handler: async (ctx) => {
13
+ // 每页数量限制
14
+ const limit = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
15
+ // 用项目中已有的获取页面方法,获取页面以及 Token
16
+ const currentUrl = new URL('discover', rootUrl).href;
17
+ const currentHtml = await ofetch(currentUrl);
18
+ const $ = load(currentHtml);
19
+ const logoSrc = $('img.logo').prop('src');
20
+ const image = logoSrc ? new URL(logoSrc, rootUrl).href : '';
21
+ const author = $('title').text().split(/_/).pop();
22
+ const { apiInfoListUrl } = await buildApiUrl($);
23
+ // 获取资讯列表,解析数据
24
+ const data: NewsItem[] = await ofetch(apiInfoListUrl, {
25
+ headers: {
26
+ accept: 'application/json;charset=utf-8',
27
+ },
28
+ query: {
29
+ pagesize: limit,
30
+ page: 1,
31
+ type: 1,
32
+ isen: 0,
33
+ },
34
+ });
35
+ const items = data.map((item) => ({
36
+ // 文章标题
37
+ title: item.title,
38
+ // 文章链接
39
+ link: `https://www.aibase.com/zh/news/${item.Id}`,
40
+ // 文章正文
41
+ description: item.summary,
42
+ // 文章发布日期
43
+ pubDate: parseDate(item.addtime),
44
+ // 文章作者
45
+ author: item.author || 'AI Base',
46
+ }));
47
+
48
+ return {
49
+ title: 'AI新闻资讯',
50
+ description: 'AI新闻资讯 - 不错过全球AI革新的每一个时刻',
51
+ language: 'zh-cn',
52
+ link: 'https://www.aibase.com/zh/news',
53
+ item: items,
54
+ allowEmpty: true,
55
+ image,
56
+ author,
57
+ };
58
+ },
59
+ example: '/aibase/news',
60
+ description: '获取 AI 资讯列表',
61
+ categories: ['new-media'],
62
+ features: {
63
+ requireConfig: false,
64
+ requirePuppeteer: false,
65
+ antiCrawler: false,
66
+ supportRadar: true,
67
+ supportBT: false,
68
+ supportPodcast: false,
69
+ supportScihub: false,
70
+ },
71
+ radar: [
72
+ {
73
+ source: ['www.aibase.com/zh/news'],
74
+ target: '/news',
75
+ },
76
+ ],
77
+ };
78
+
79
+ /** API 返回的资讯结构 */
80
+ interface NewsItem {
81
+ /** 文章 ID */
82
+ Id: number;
83
+ /** 文章标题 */
84
+ title: string;
85
+ /** 文章副标题 */
86
+ subtitle: string;
87
+ /** 文章简要描述 */
88
+ description: string;
89
+ /** 文章主图 */
90
+ thumb: string;
91
+ classname: string;
92
+ /** 正文总结 */
93
+ summary: string;
94
+ /** 标签,字符串,样例:[\"人工智能\",\"Hingham高中\"] */
95
+ tags: string;
96
+ /** 可能是来源 */
97
+ sourcename: string;
98
+ /** 作者 */
99
+ author: string;
100
+ status: number;
101
+ url: string;
102
+ type: number;
103
+ added: number;
104
+ /** 添加时间 */
105
+ addtime: string;
106
+ /** 更新时间 */
107
+ upded: number;
108
+ updtime: string;
109
+ isshoulu: number;
110
+ vurl: string;
111
+ vsize: number;
112
+ weight: number;
113
+ isailog: number;
114
+ sites: string;
115
+ categrates: string;
116
+ /** 访问量 */
117
+ pv: number;
118
+ }
@@ -57,11 +57,14 @@ const buildApiUrl = async ($: CheerioAPI) => {
57
57
  const apiRecommListUrl = new URL(`${token}/ai/GetAIProcRecommList.aspx`, apiRootUrl).href;
58
58
  const apiRecommProcUrl = new URL(`${token}/ai/GetAIProcListByRecomm.aspx`, apiRootUrl).href;
59
59
  const apiTagProcUrl = new URL(`${token}/ai/GetAiProductOfTag.aspx`, apiRootUrl).href;
60
+ // AI 资讯列表
61
+ const apiInfoListUrl = new URL(`${token}/ai/GetAiInfoList.aspx`, apiRootUrl).href;
60
62
 
61
63
  return {
62
64
  apiRecommListUrl,
63
65
  apiRecommProcUrl,
64
66
  apiTagProcUrl,
67
+ apiInfoListUrl,
65
68
  };
66
69
  };
67
70
 
@@ -25,7 +25,7 @@ export const route: Route = {
25
25
  },
26
26
  ],
27
27
  name: 'UP 主投稿',
28
- maintainers: ['DIYgod'],
28
+ maintainers: ['DIYgod', 'Konano'],
29
29
  handler,
30
30
  };
31
31
 
@@ -0,0 +1,264 @@
1
+ import { Route } from '@/types';
2
+
3
+ import cache from '@/utils/cache';
4
+ import got from '@/utils/got';
5
+ import { load } from 'cheerio';
6
+ import { parseDate } from '@/utils/parse-date';
7
+
8
+ export const handler = async (ctx) => {
9
+ const { id = '9' } = ctx.req.param();
10
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20;
11
+
12
+ const domain = 'www.cisia.org';
13
+ const rootUrl = `http://${domain}`;
14
+ const currentUrl = new URL(`site/term/${id}.html`, rootUrl).href;
15
+
16
+ const { data: response } = await got(currentUrl);
17
+
18
+ const $ = load(response);
19
+
20
+ let items = $('ul.list_first li')
21
+ .slice(0, limit)
22
+ .toArray()
23
+ .map((item) => {
24
+ item = $(item);
25
+
26
+ const a = item.find('a');
27
+
28
+ return {
29
+ title: a.text(),
30
+ pubDate: parseDate(item.find('span.time').text()),
31
+ link: new URL(a.prop('href'), rootUrl).href,
32
+ };
33
+ });
34
+
35
+ items = await Promise.all(
36
+ items.map((item) =>
37
+ cache.tryGet(item.link, async () => {
38
+ if (!/^https?:\/\/www\.cisia\.org(\/[^\s]*)?$/.test(item.link)) {
39
+ return item;
40
+ }
41
+
42
+ const { data: detailResponse } = await got(item.link);
43
+
44
+ const $$ = load(detailResponse);
45
+
46
+ const title = $$('div.TextTitle').text();
47
+ const description = $$('div.NewsText').html();
48
+ const pubDate = $$('div.shar')
49
+ .text()
50
+ .match(/(\d{4}-\d{2}-\d{2})/)?.[1];
51
+
52
+ item.title = title;
53
+ item.description = description;
54
+ item.pubDate = pubDate ? parseDate(pubDate) : item.pubDate;
55
+ item.author = $$('meta[name="Description"]').prop('content');
56
+ item.content = {
57
+ html: description,
58
+ text: $$('div.NewsText').text(),
59
+ };
60
+
61
+ return item;
62
+ })
63
+ )
64
+ );
65
+
66
+ const image = new URL($('div.logo img').prop('src'), rootUrl).href;
67
+
68
+ return {
69
+ title: $('title').text(),
70
+ description: $('meta[name="Description"]').prop('content'),
71
+ link: currentUrl,
72
+ item: items,
73
+ allowEmpty: true,
74
+ image,
75
+ author: $('meta[name="Keywords"]').prop('content'),
76
+ };
77
+ };
78
+
79
+ export const route: Route = {
80
+ path: '/:id?',
81
+ name: '栏目',
82
+ url: 'www.cisia.org',
83
+ maintainers: ['nczitzk'],
84
+ handler,
85
+ example: '/cisia/9',
86
+ parameters: { id: '栏目 id,默认为 `9`,即协会动态,可在对应分类页 URL 中找到' },
87
+ description: `:::tip
88
+ 若订阅 [市场信息](http://www.cisia.org/site/term/12.html),网址为 \`http://www.cisia.org/site/term/12.html\`。截取 \`https://www.cisia.org/site/term/\` 到末尾 \`.html\` 的部分 \`12\` 作为参数填入,此时路由为 [\`/cisia/12\`](https://rsshub.app/cisia/12)。
89
+ :::
90
+
91
+ <details>
92
+ <summary>更多分类</summary>
93
+
94
+ #### [分支机构信息](http://www.cisia.org/site/term/14.html)
95
+
96
+ | [企业动态](http://www.cisia.org/site/term/17.html) | [产品展示](http://www.cisia.org/site/term/18.html) |
97
+ | -------------------------------------------------- | -------------------------------------------------- |
98
+ | [17](https://rsshub.app/cisia/17) | [18](https://rsshub.app/cisia/18) |
99
+
100
+ #### [新闻中心](http://www.cisia.org/site/term/8.html)
101
+
102
+ | [协会动态](http://www.cisia.org/site/term/9.html) | [行业新闻](http://www.cisia.org/site/term/10.html) | [通知公告](http://www.cisia.org/site/term/11.html) | [市场信息](http://www.cisia.org/site/term/12.html) |
103
+ | ------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
104
+ | [9](https://rsshub.app/cisia/9) | [10](https://rsshub.app/cisia/10) | [11](https://rsshub.app/cisia/11) | [12](https://rsshub.app/cisia/12) |
105
+
106
+ #### [政策法规](http://www.cisia.org/site/term/19.html)
107
+
108
+ | [宏观聚焦](http://www.cisia.org/site/term/20.html) | [技术园区](http://www.cisia.org/site/term/396.html) |
109
+ | -------------------------------------------------- | --------------------------------------------------- |
110
+ | [20](https://rsshub.app/cisia/20) | [396](https://rsshub.app/cisia/396) |
111
+
112
+ #### [合作交流](http://www.cisia.org/site/term/22.html)
113
+
114
+ | [国际交流](http://www.cisia.org/site/term/23.html) | [行业交流](http://www.cisia.org/site/term/24.html) | [企业调研](http://www.cisia.org/site/term/25.html) | [会展信息](http://www.cisia.org/site/term/84.html) | [宣传专题](http://www.cisia.org/site/term/430.html) |
115
+ | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------- |
116
+ | [23](https://rsshub.app/cisia/23) | [24](https://rsshub.app/cisia/24) | [25](https://rsshub.app/cisia/25) | [84](https://rsshub.app/cisia/84) | [430](https://rsshub.app/cisia/430) |
117
+
118
+ #### [党建工作](http://www.cisia.org/site/term/26.html)
119
+
120
+ | [党委文件](http://www.cisia.org/site/term/27.html) | [学习园地](http://www.cisia.org/site/term/28.html) | [两会专题](http://www.cisia.org/site/term/443.html) |
121
+ | -------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------- |
122
+ | [27](https://rsshub.app/cisia/27) | [28](https://rsshub.app/cisia/28) | [443](https://rsshub.app/cisia/443) |
123
+
124
+ #### [网上服务平台](http://www.cisia.org/site/term/29.html)
125
+
126
+ | [前沿科技](http://www.cisia.org/site/term/31.html) | [新材料新技术](http://www.cisia.org/site/term/133.html) | [文件共享](http://www.cisia.org/site/term/30.html) |
127
+ | -------------------------------------------------- | ------------------------------------------------------- | -------------------------------------------------- |
128
+ | [31](https://rsshub.app/cisia/31) | [133](https://rsshub.app/cisia/133) | [30](https://rsshub.app/cisia/30) |
129
+
130
+ #### [会员社区](http://www.cisia.org/site/term/34.html)
131
+
132
+ | [会员分布](http://www.cisia.org/site/term/35.html) | [会员风采](http://www.cisia.org/site/term/68.html) |
133
+ | -------------------------------------------------- | -------------------------------------------------- |
134
+ | [35](https://rsshub.app/cisia/35) | [68](https://rsshub.app/cisia/68) |
135
+
136
+ </details>
137
+ `,
138
+ categories: ['government'],
139
+
140
+ features: {
141
+ requireConfig: false,
142
+ requirePuppeteer: false,
143
+ antiCrawler: false,
144
+ supportRadar: true,
145
+ supportBT: false,
146
+ supportPodcast: false,
147
+ supportScihub: false,
148
+ },
149
+ radar: [
150
+ {
151
+ source: ['www.cisia.org/site/term/:id'],
152
+ target: (params) => {
153
+ const id = params.id.replace(/\.html/, '');
154
+
155
+ return id ? `/${id}` : '';
156
+ },
157
+ },
158
+ {
159
+ title: '分支机构信息 - 企业动态',
160
+ source: ['www.cisia.org/site/term/17.html'],
161
+ target: '/17',
162
+ },
163
+ {
164
+ title: '分支机构信息 - 产品展示',
165
+ source: ['www.cisia.org/site/term/18.html'],
166
+ target: '/18',
167
+ },
168
+ {
169
+ title: '新闻中心 - 协会动态',
170
+ source: ['www.cisia.org/site/term/9.html'],
171
+ target: '/9',
172
+ },
173
+ {
174
+ title: '新闻中心 - 行业新闻',
175
+ source: ['www.cisia.org/site/term/10.html'],
176
+ target: '/10',
177
+ },
178
+ {
179
+ title: '新闻中心 - 通知公告',
180
+ source: ['www.cisia.org/site/term/11.html'],
181
+ target: '/11',
182
+ },
183
+ {
184
+ title: '新闻中心 - 市场信息',
185
+ source: ['www.cisia.org/site/term/12.html'],
186
+ target: '/12',
187
+ },
188
+ {
189
+ title: '政策法规 - 宏观聚焦',
190
+ source: ['www.cisia.org/site/term/20.html'],
191
+ target: '/20',
192
+ },
193
+ {
194
+ title: '政策法规 - 技术园区',
195
+ source: ['www.cisia.org/site/term/396.html'],
196
+ target: '/396',
197
+ },
198
+ {
199
+ title: '合作交流 - 国际交流',
200
+ source: ['www.cisia.org/site/term/23.html'],
201
+ target: '/23',
202
+ },
203
+ {
204
+ title: '合作交流 - 行业交流',
205
+ source: ['www.cisia.org/site/term/24.html'],
206
+ target: '/24',
207
+ },
208
+ {
209
+ title: '合作交流 - 企业调研',
210
+ source: ['www.cisia.org/site/term/25.html'],
211
+ target: '/25',
212
+ },
213
+ {
214
+ title: '合作交流 - 会展信息',
215
+ source: ['www.cisia.org/site/term/84.html'],
216
+ target: '/84',
217
+ },
218
+ {
219
+ title: '合作交流 - 宣传专题',
220
+ source: ['www.cisia.org/site/term/430.html'],
221
+ target: '/430',
222
+ },
223
+ {
224
+ title: '党建工作 - 党委文件',
225
+ source: ['www.cisia.org/site/term/27.html'],
226
+ target: '/27',
227
+ },
228
+ {
229
+ title: '党建工作 - 学习园地',
230
+ source: ['www.cisia.org/site/term/28.html'],
231
+ target: '/28',
232
+ },
233
+ {
234
+ title: '党建工作 - 两会专题',
235
+ source: ['www.cisia.org/site/term/443.html'],
236
+ target: '/443',
237
+ },
238
+ {
239
+ title: '网上服务平台 - 前沿科技',
240
+ source: ['www.cisia.org/site/term/31.html'],
241
+ target: '/31',
242
+ },
243
+ {
244
+ title: '网上服务平台 - 新材料新技术',
245
+ source: ['www.cisia.org/site/term/133.html'],
246
+ target: '/133',
247
+ },
248
+ {
249
+ title: '网上服务平台 - 文件共享',
250
+ source: ['www.cisia.org/site/term/30.html'],
251
+ target: '/30',
252
+ },
253
+ {
254
+ title: '会员社区 - 会员分布',
255
+ source: ['www.cisia.org/site/term/35.html'],
256
+ target: '/35',
257
+ },
258
+ {
259
+ title: '会员社区 - 会员风采',
260
+ source: ['www.cisia.org/site/term/68.html'],
261
+ target: '/68',
262
+ },
263
+ ],
264
+ };
@@ -0,0 +1,8 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '中国无机盐工业协会',
5
+ url: 'www.cisia.org',
6
+ categories: ['government'],
7
+ description: '',
8
+ };
@@ -0,0 +1,10 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'China Jiliang University',
5
+ url: 'www.cjlu.edu.cn',
6
+
7
+ zh: {
8
+ name: '中国计量大学',
9
+ },
10
+ };
@@ -0,0 +1,107 @@
1
+ import { Route } from '@/types';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { load } from 'cheerio';
4
+ import { parseDate } from '@/utils/parse-date';
5
+ import cache from '@/utils/cache';
6
+ import timezone from '@/utils/timezone';
7
+
8
+ const host = 'https://yjsy.cjlu.edu.cn/';
9
+
10
+ const titleMap = new Map([
11
+ ['yjstz', '中量大研究生院 —— 研究生通知'],
12
+ ['jstz', '中量大研究生院 —— 教师通知'],
13
+ ]);
14
+
15
+ export const route: Route = {
16
+ path: '/yjsy/:cate',
17
+ categories: ['university'],
18
+ example: '/cjlu/yjsy/yjstz',
19
+ parameters: {
20
+ cate: '订阅的类型,支持 yjstz(研究生通知)和 jstz(教师通知)',
21
+ },
22
+ features: {
23
+ requireConfig: false,
24
+ requirePuppeteer: false,
25
+ antiCrawler: false,
26
+ supportRadar: true,
27
+ supportBT: false,
28
+ supportPodcast: false,
29
+ supportScihub: false,
30
+ },
31
+ radar: [
32
+ {
33
+ title: '研究生通知',
34
+ source: ['yjsy.cjlu.edu.cn/index/yjstz/:suffix', 'yjsy.cjlu.edu.cn/index/yjstz.htm'],
35
+ target: '/yjsy/yjstz',
36
+ },
37
+ {
38
+ title: '教师通知',
39
+ source: ['yjsy.cjlu.edu.cn/index/jstz/:suffix', 'yjsy.cjlu.edu.cn/index/jstz.htm'],
40
+ target: '/yjsy/jstz',
41
+ },
42
+ ],
43
+ name: '研究生院',
44
+ maintainers: ['chrisis58'],
45
+ handler,
46
+ description: `| 研究生通知 | 教师通知 |
47
+ | -------- | -------- |
48
+ | yjstz | jstz |`,
49
+ };
50
+
51
+ async function handler(ctx) {
52
+ const cate = ctx.req.param('cate');
53
+
54
+ const response = await ofetch(`${cate}.htm`, {
55
+ baseURL: `${host}/index/`,
56
+ responseType: 'text',
57
+ });
58
+
59
+ const $ = load(response);
60
+
61
+ const list = $('div.grid685.right div.body ul')
62
+ .find('li')
63
+ .toArray()
64
+ .map((element) => {
65
+ const item = $(element);
66
+
67
+ const a = item.find('a').first();
68
+
69
+ const timeStr = item.find('span').first().text().trim();
70
+ const href = a.attr('href') ?? '';
71
+ const route = href.startsWith('../') ? href.replace(/^\.\.\//, '') : href;
72
+
73
+ return {
74
+ title: a.attr('title') ?? titleMap.get(cate),
75
+ pubDate: timezone(parseDate(timeStr, 'YYYY/MM/DD'), +8),
76
+ link: `${host}${route}`,
77
+ description: '',
78
+ };
79
+ });
80
+
81
+ const items = await Promise.all(
82
+ list.map((item) =>
83
+ cache.tryGet(item.link, async () => {
84
+ if (!item.link || item.link === host) {
85
+ return item;
86
+ }
87
+
88
+ const res = await ofetch(item.link, {
89
+ responseType: 'text',
90
+ });
91
+ const $ = load(res);
92
+
93
+ const content = $('#vsb_content').html() ?? '';
94
+ const attachments = $('form[name="_newscontent_fromname"] div ul').html() ?? '';
95
+
96
+ item.description = `${content}<br>${attachments}`;
97
+ return item;
98
+ })
99
+ )
100
+ );
101
+
102
+ return {
103
+ title: titleMap.get(cate),
104
+ link: `https://yjsy.cjlu.edu.cn/index/${cate}.htm`,
105
+ item: items,
106
+ };
107
+ }
@@ -15,13 +15,13 @@ export const route: Route = {
15
15
  features: {
16
16
  requireConfig: false,
17
17
  requirePuppeteer: false,
18
- antiCrawler: false,
18
+ antiCrawler: true,
19
19
  supportBT: false,
20
20
  supportPodcast: false,
21
21
  supportScihub: false,
22
22
  },
23
23
  name: '票务更新',
24
- maintainers: ['hoilc'],
24
+ maintainers: ['hoilc', 'Konano'],
25
25
  handler,
26
26
  description: `城市、分类名、子分类名,请参见[大麦网搜索页面](https://search.damai.cn/search.htm)`,
27
27
  };
@@ -55,6 +55,7 @@ async function handler(ctx) {
55
55
  return {
56
56
  title: `大麦网票务 - ${city || '全国'} - ${category || '全部分类'}${subcategory ? ' - ' + subcategory : ''}${keyword ? ' - ' + keyword : ''}`,
57
57
  link: 'https://search.damai.cn/search.htm',
58
+ allowEmpty: true,
58
59
  item: list.map((item) => ({
59
60
  title: item.nameNoHtml,
60
61
  author: item.actors ? load(item.actors, null, false).text() : '大麦网',
@@ -106,7 +106,7 @@ async function handler(ctx) {
106
106
  },
107
107
  });
108
108
 
109
- const list = (data.pageProps.categoryArticleData as CategoryArticle[])
109
+ const list = (data.pageProps.categoryArticleDataForPc as CategoryArticle[])
110
110
  .filter((item) => !item.advertiserName)
111
111
  .map((item) => {
112
112
  const publicationDate = item.publishedAt?.slice(0, 7).replace('-', '');
@@ -1,4 +1,4 @@
1
- import { Route } from '@/types';
1
+ import type { Data, DataItem, Route } from '@/types';
2
2
  import cache from '@/utils/cache';
3
3
  import got from '@/utils/got';
4
4
  import { load } from 'cheerio';
@@ -23,51 +23,45 @@ export const route: Route = {
23
23
  },
24
24
  ],
25
25
  name: 'Hex-Rays News',
26
- maintainers: ['hellodword ', 'TonyRL'],
26
+ maintainers: ['hellodword ', 'TonyRL', 'Mas0n'],
27
27
  handler,
28
28
  url: 'hex-rays.com/',
29
29
  };
30
30
 
31
- async function handler() {
32
- const link = 'https://www.hex-rays.com/blog/';
31
+ async function handler(/* ctx*/): Promise<Data> {
32
+ const link = 'https://hex-rays.com/blog/';
33
33
  const response = await got.get(link);
34
34
  const $ = load(response.data);
35
35
 
36
- const list = $('.post-list-container')
37
- .map((_, ele) => ({
38
- title: $('h3 > a', ele).text(),
39
- link: $('h3 > a', ele).attr('href'),
40
- pubDate: parseDate($('.post-meta:nth-of-type(1)', ele).first().text().trim().replace('Posted on:', '')),
41
- author: $('.post-meta:nth-of-type(2)', ele).first().text().replace('By:', '').trim(),
42
- }))
43
- .get();
36
+ const list: DataItem[] = $('.article ')
37
+ .toArray()
38
+ .map(
39
+ (ele): DataItem => ({
40
+ title: $('h2 > a', ele).text(),
41
+ link: $('h2 > a', ele).attr('href'),
42
+ pubDate: parseDate($('div.by-line > time', ele).attr('datetime')!),
43
+ author: $('div.by-line > a', ele).text(),
44
+ })
45
+ );
44
46
 
45
- const items = await Promise.all(
46
- list.map((item) =>
47
- cache.tryGet(item.link, async () => {
47
+ const items: DataItem[] = await Promise.all(
48
+ list.map((item: DataItem) =>
49
+ cache.tryGet(item.link!, async () => {
48
50
  const detailResponse = await got.get(item.link);
49
51
  const content = load(detailResponse.data);
50
-
51
- item.category = (
52
- content('.category-link')
53
- .toArray()
54
- .map((e) => $(e).text()) +
55
- ',' +
56
- content('.tag-link')
57
- .toArray()
58
- .map((e) => $(e).text())
59
- ).split(',');
60
-
61
- item.description = content('.post-content').html();
62
-
52
+ item.category = content('.div.topics > a')
53
+ .toArray()
54
+ .map((ele) => content(ele).text());
55
+ item.description = content('.post-body').toString();
63
56
  return item;
64
57
  })
65
- )
58
+ ) as Promise<DataItem>[]
66
59
  );
67
60
 
68
61
  return {
69
62
  title: 'Hex-Rays Blog',
70
63
  link,
71
64
  item: items,
65
+ image: 'https://hex-rays.com/hubfs/Ico-logo.png',
72
66
  };
73
67
  }