rsshub 1.0.0-master.db98160 → 1.0.0-master.db9d5ce

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 (99) hide show
  1. package/lib/api/follow/config.ts +23 -0
  2. package/lib/api/index.ts +2 -0
  3. package/lib/config.ts +13 -1
  4. package/lib/routes/163/music/djradio.ts +27 -20
  5. package/lib/routes/163/templates/music/djradio-content.art +2 -0
  6. package/lib/routes/ali213/namespace.ts +9 -0
  7. package/lib/routes/ali213/news.ts +269 -0
  8. package/lib/routes/ali213/templates/description.art +21 -0
  9. package/lib/routes/ali213/zl.ts +226 -0
  10. package/lib/routes/anthropic/namespace.ts +7 -0
  11. package/lib/routes/anthropic/news.ts +60 -0
  12. package/lib/routes/apnic/index.ts +61 -0
  13. package/lib/routes/apnic/namespace.ts +8 -0
  14. package/lib/routes/baijing/index.ts +48 -0
  15. package/lib/routes/baijing/namespace.ts +8 -0
  16. package/lib/routes/bbc/index.ts +47 -42
  17. package/lib/routes/behance/queries.ts +1015 -0
  18. package/lib/routes/behance/templates/description.art +23 -0
  19. package/lib/routes/behance/user.ts +78 -55
  20. package/lib/routes/bilibili/user-channel.ts +1 -0
  21. package/lib/routes/bilibili/user-collection.ts +1 -0
  22. package/lib/routes/blizzard/news.ts +120 -31
  23. package/lib/routes/chinacdc/index.ts +490 -0
  24. package/lib/routes/chinacdc/namespace.ts +9 -0
  25. package/lib/routes/chinacdc/templates/description.art +7 -0
  26. package/lib/routes/chongdiantou/index.ts +54 -0
  27. package/lib/routes/chongdiantou/namespace.ts +9 -0
  28. package/lib/routes/copernicium/index.ts +29 -21
  29. package/lib/routes/daoxuan/namespace.ts +7 -0
  30. package/lib/routes/daoxuan/rss.ts +43 -0
  31. package/lib/routes/duckdb/news.ts +3 -4
  32. package/lib/routes/dytt/index.ts +75 -0
  33. package/lib/routes/dytt/namespace.ts +7 -0
  34. package/lib/routes/egsea/flash.ts +1 -1
  35. package/lib/routes/follow/profile.ts +4 -2
  36. package/lib/routes/gdufs/namespace.ts +7 -0
  37. package/lib/routes/gdufs/news.ts +94 -0
  38. package/lib/routes/gdufs/xwxy/xwxy-news.ts +90 -0
  39. package/lib/routes/github/repos.ts +55 -18
  40. package/lib/routes/gov/hainan/iitb/tzgg.ts +77 -0
  41. package/lib/routes/gov/hainan/namespace.ts +8 -0
  42. package/lib/routes/hexun/index.ts +74 -0
  43. package/lib/routes/hexun/namespace.ts +8 -0
  44. package/lib/routes/hiring.cafe/jobs.ts +150 -0
  45. package/lib/routes/hiring.cafe/namespace.ts +10 -0
  46. package/lib/routes/hiring.cafe/templates/jobs.art +18 -0
  47. package/lib/routes/hket/index.ts +1 -1
  48. package/lib/routes/home-assistant/hacs.ts +50 -0
  49. package/lib/routes/home-assistant/namespace.ts +7 -0
  50. package/lib/routes/hrbust/namespace.ts +2 -1
  51. package/lib/routes/hrbust/news.ts +81 -0
  52. package/lib/routes/iheima/index.ts +44 -0
  53. package/lib/routes/iheima/namespace.ts +8 -0
  54. package/lib/routes/iresearch/chart.ts +375 -0
  55. package/lib/routes/iresearch/templates/chart.art +13 -0
  56. package/lib/routes/isct/namespace.ts +4 -4
  57. package/lib/routes/jimmyspa/books.ts +112 -0
  58. package/lib/routes/jimmyspa/namespace.ts +7 -0
  59. package/lib/routes/jimmyspa/news.ts +124 -0
  60. package/lib/routes/jimmyspa/templates/description.art +17 -0
  61. package/lib/routes/joneslanglasalle/index.ts +3 -2
  62. package/lib/routes/kuaishou/namespace.ts +8 -0
  63. package/lib/routes/kuaishou/profile.ts +92 -0
  64. package/lib/routes/mittrchina/index.ts +5 -3
  65. package/lib/routes/newseed/index.ts +73 -0
  66. package/lib/routes/newseed/namespace.ts +8 -0
  67. package/lib/routes/papers/index.ts +5 -3
  68. package/lib/routes/papers/templates/description.art +4 -0
  69. package/lib/routes/picnob/templates/desc.art +1 -1
  70. package/lib/routes/qbitai/category.ts +25 -11
  71. package/lib/routes/qweather/3days.ts +4 -3
  72. package/lib/routes/qweather/now.ts +12 -9
  73. package/lib/routes/shu/global.ts +1 -0
  74. package/lib/routes/shu/gs.ts +1 -0
  75. package/lib/routes/shu/index.ts +1 -0
  76. package/lib/routes/shu/jwb.ts +1 -0
  77. package/lib/routes/shu/society.ts +62 -0
  78. package/lib/routes/shu/xykd.ts +1 -0
  79. package/lib/routes/sjtu/jwc.ts +18 -14
  80. package/lib/routes/smzdm/haowen.ts +35 -19
  81. package/lib/routes/sohu/mp.ts +17 -0
  82. package/lib/routes/spglobal/namespace.ts +7 -0
  83. package/lib/routes/spglobal/ratings.ts +64 -0
  84. package/lib/routes/techsir/index.ts +67 -0
  85. package/lib/routes/techsir/namespace.ts +8 -0
  86. package/lib/routes/twitter/api/web-api/constants.ts +3 -1
  87. package/lib/routes/twitter/api/web-api/utils.ts +38 -21
  88. package/lib/routes/twitter/keyword.ts +5 -1
  89. package/lib/routes/twitter/list.ts +4 -0
  90. package/lib/routes/twitter/user.ts +1 -1
  91. package/lib/routes/wabei/index.ts +75 -0
  92. package/lib/routes/wabei/namespace.ts +8 -0
  93. package/lib/routes/whu/swrh.ts +115 -0
  94. package/lib/routes/xiaohongshu/user.ts +1 -1
  95. package/lib/routes/xueqiu/column.ts +11 -2
  96. package/lib/routes/zaobao/util.ts +13 -7
  97. package/lib/types.ts +3 -3
  98. package/package.json +31 -31
  99. package/lib/routes-deprecated/dytt/index.js +0 -60
@@ -0,0 +1,23 @@
1
+ import { config } from '@/config';
2
+ import { createRoute, RouteHandler } from '@hono/zod-openapi';
3
+
4
+ const route = createRoute({
5
+ method: 'get',
6
+ path: '/follow/config',
7
+ tags: ['Follow'],
8
+ responses: {
9
+ 200: {
10
+ description: 'Follow config',
11
+ },
12
+ },
13
+ });
14
+
15
+ const handler: RouteHandler<typeof route> = (ctx) =>
16
+ ctx.json({
17
+ ownerUserId: config.follow.ownerUserId,
18
+ description: config.follow.description,
19
+ price: config.follow.price,
20
+ limit: config.follow.limit,
21
+ });
22
+
23
+ export { route, handler };
package/lib/api/index.ts CHANGED
@@ -4,6 +4,7 @@ import { route as namespaceOneRoute, handler as namespaceOneHandler } from '@/ap
4
4
  import { route as radarRulesAllRoute, handler as radarRulesAllHandler } from '@/api/radar/rules/all';
5
5
  import { route as radarRulesOneRoute, handler as radarRulesOneHandler } from '@/api/radar/rules/one';
6
6
  import { route as categoryOneRoute, handler as categoryOneHandler } from '@/api/category/one';
7
+ import { route as followConfigRoute, handler as followConfigHandler } from '@/api/follow/config';
7
8
  import { OpenAPIHono } from '@hono/zod-openapi';
8
9
  import { apiReference } from '@scalar/hono-api-reference';
9
10
 
@@ -14,6 +15,7 @@ app.openapi(namespaceOneRoute, namespaceOneHandler);
14
15
  app.openapi(radarRulesAllRoute, radarRulesAllHandler);
15
16
  app.openapi(radarRulesOneRoute, radarRulesOneHandler);
16
17
  app.openapi(categoryOneRoute, categoryOneHandler);
18
+ app.openapi(followConfigRoute, followConfigHandler);
17
19
 
18
20
  const docs = app.getOpenAPI31Document({
19
21
  openapi: '3.1.0',
package/lib/config.ts CHANGED
@@ -86,6 +86,12 @@ export type Config = {
86
86
  promptTitle: string;
87
87
  promptDescription: string;
88
88
  };
89
+ follow: {
90
+ ownerUserId?: string;
91
+ description?: string;
92
+ price?: number;
93
+ limit?: number;
94
+ };
89
95
 
90
96
  // Route-specific Configurations
91
97
  bilibili: {
@@ -398,7 +404,7 @@ const toBoolean = (value: string | undefined, defaultValue: boolean) => {
398
404
  }
399
405
  };
400
406
 
401
- const toInt = (value: string | undefined, defaultValue: number) => (value === undefined ? defaultValue : Number.parseInt(value));
407
+ const toInt = (value: string | undefined, defaultValue?: number) => (value === undefined ? defaultValue : Number.parseInt(value));
402
408
 
403
409
  const calculateValue = () => {
404
410
  const bilibili_cookies: Record<string, string | undefined> = {};
@@ -510,6 +516,12 @@ const calculateValue = () => {
510
516
  promptDescription: envs.OPENAI_PROMPT || 'Please summarize the following article and reply with markdown format.',
511
517
  promptTitle: envs.OPENAI_PROMPT_TITLE || 'Please translate the following title into Simplified Chinese and reply only translated text.',
512
518
  },
519
+ follow: {
520
+ ownerUserId: envs.FOLLOW_OWNER_USER_ID,
521
+ description: envs.FOLLOW_DESCRIPTION,
522
+ price: toInt(envs.FOLLOW_PRICE),
523
+ limit: toInt(envs.FOLLOW_LIMIT),
524
+ },
513
525
 
514
526
  // Route-specific Configurations
515
527
  bilibili: {
@@ -6,12 +6,14 @@ import got from '@/utils/got';
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';
10
+ import { config } from '@/config';
9
11
 
10
12
  export const route: Route = {
11
- path: '/music/djradio/:id',
13
+ path: '/music/djradio/:id/:info?',
12
14
  categories: ['multimedia'],
13
15
  example: '/163/music/djradio/347317067',
14
- parameters: { id: '节目 id, 可在电台节目页 URL 中找到' },
16
+ parameters: { id: '节目 id, 可在电台节目页 URL 中找到', info: '默认在正文尾部显示节目相关信息,任意值为不显示' },
15
17
  features: {
16
18
  requireConfig: false,
17
19
  requirePuppeteer: false,
@@ -25,35 +27,39 @@ export const route: Route = {
25
27
  handler,
26
28
  };
27
29
 
30
+ const ProcessFeed = (id, limit, offset) =>
31
+ cache.tryGet(
32
+ `163:music:djradio:${id}:${limit}:${offset}`,
33
+ async () =>
34
+ await got.post('https://music.163.com/api/dj/program/byradio', {
35
+ headers: {
36
+ Referer: 'https://music.163.com/',
37
+ },
38
+ form: {
39
+ radioId: id,
40
+ limit,
41
+ offset,
42
+ },
43
+ }),
44
+ config.cache.routeExpire,
45
+ false
46
+ );
47
+
28
48
  async function handler(ctx) {
29
49
  const id = ctx.req.param('id');
50
+ const info = !ctx.req.param('info');
30
51
 
31
- const ProcessFeed = (limit, offset) =>
32
- got.post('https://music.163.com/api/dj/program/byradio', {
33
- headers: {
34
- Referer: 'https://music.163.com/',
35
- },
36
- form: {
37
- radioId: id,
38
- limit,
39
- offset,
40
- },
41
- });
42
-
43
- const response = await ProcessFeed(1, 0);
52
+ const response = await ProcessFeed(id, 1, 0);
44
53
 
45
54
  const programs = response.data.programs || [];
46
55
  const { radio, dj } = programs[0] || { radio: {}, dj: {} };
47
56
  const count = response.data.count || 0;
48
57
 
49
- const countPage = [];
50
- for (let i = 0; i < Math.ceil(count / 500); i++) {
51
- countPage.push(i);
52
- }
58
+ const countPage = Array.from({ length: Math.ceil(count / 500) }, (_, i) => i);
53
59
 
54
60
  const items = await Promise.all(
55
61
  countPage.map(async (item) => {
56
- const response = await ProcessFeed(500, item * 500);
62
+ const response = await ProcessFeed(id, 500, item * 500);
57
63
  const programs = response.data.programs || [];
58
64
  const list = programs.map((pg) => {
59
65
  const description = (pg.description || '').split('\n').map((p) => p);
@@ -64,6 +70,7 @@ async function handler(ctx) {
64
70
  pg,
65
71
  description,
66
72
  itunes_duration: mm_ss_duration,
73
+ info,
67
74
  });
68
75
 
69
76
  return {
@@ -4,8 +4,10 @@
4
4
  <p>{{$value}}</p>
5
5
  {{/each}}
6
6
  </div>
7
+ {{ if info }}
7
8
  <div>
8
9
  <audio src="https://music.163.com/song/media/outer/url?id={{pg.mainTrackId}}.mp3" controls="controls"></audio>
9
10
  <p>时长: {{itunes_duration}}</p>
10
11
  <p><a href="https://music.163.com/program/{{pg.id}}">查看节目</a></p>
11
12
  </div>
13
+ {{ /if }}
@@ -0,0 +1,9 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '游侠网',
5
+ url: 'ali213.net',
6
+ categories: ['game'],
7
+ description: '',
8
+ lang: 'zh-CN',
9
+ };
@@ -0,0 +1,269 @@
1
+ import path from 'node:path';
2
+
3
+ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
4
+ import { type Context } from 'hono';
5
+
6
+ import { type DataItem, type Route, type Data, ViewType } from '@/types';
7
+
8
+ import { art } from '@/utils/render';
9
+ import cache from '@/utils/cache';
10
+ import { getCurrentPath } from '@/utils/helpers';
11
+ import ofetch from '@/utils/ofetch';
12
+ import { parseDate } from '@/utils/parse-date';
13
+ import timezone from '@/utils/timezone';
14
+
15
+ const __dirname = getCurrentPath(import.meta.url);
16
+
17
+ export const handler = async (ctx: Context): Promise<Data> => {
18
+ const { category = 'new' } = ctx.req.param();
19
+ const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
20
+
21
+ const rootUrl: string = 'https://www.ali213.net';
22
+ const targetUrl: string = new URL(`news/${category.endsWith('/') ? category : `${category}/`}`, rootUrl).href;
23
+
24
+ const response = await ofetch(targetUrl);
25
+ const $: CheerioAPI = load(response);
26
+ const language: string = $('html').prop('lang') ?? 'zh-CN';
27
+
28
+ let items: DataItem[] = $('div.n_lone')
29
+ .slice(0, limit)
30
+ .toArray()
31
+ .map((item): DataItem => {
32
+ const $item: Cheerio<Element> = $(item);
33
+
34
+ const aEl: Cheerio<Element> = $item.find('h2.lone_t a');
35
+
36
+ const title: string = aEl.prop('title') || aEl.text();
37
+ const link: string | undefined = aEl.prop('href');
38
+
39
+ const imageEl: Cheerio<Element> = $item.find('img');
40
+ const imageSrc: string | undefined = imageEl?.prop('src');
41
+ const imageAlt: string | undefined = imageEl?.prop('alt');
42
+
43
+ const intro: string = $item.find('div.lone_f_r_t').text();
44
+
45
+ const description: string = art(path.join(__dirname, 'templates/description.art'), {
46
+ images: imageEl
47
+ ? [
48
+ {
49
+ src: imageSrc,
50
+ alt: imageAlt,
51
+ },
52
+ ]
53
+ : undefined,
54
+ intro,
55
+ });
56
+
57
+ const author: DataItem['author'] = $item.find('div.lone_f_r_f span').last().text().split(/:/).pop();
58
+
59
+ return {
60
+ title,
61
+ description,
62
+ pubDate: parseDate($item.find('div.lone_f_r_f span').first().text()),
63
+ link,
64
+ author,
65
+ content: {
66
+ html: description,
67
+ text: $item.find('div.lone_f_r_t').text(),
68
+ },
69
+ image: imageSrc,
70
+ banner: imageSrc,
71
+ language,
72
+ };
73
+ });
74
+
75
+ items = (
76
+ await Promise.all(
77
+ items.map((item) => {
78
+ if (!item.link && typeof item.link !== 'string') {
79
+ return item;
80
+ }
81
+
82
+ return cache.tryGet(item.link, async (): Promise<DataItem> => {
83
+ try {
84
+ const detailResponse = await ofetch(item.link);
85
+ const $$: CheerioAPI = load(detailResponse);
86
+
87
+ const title: string = $$('h1.newstit').text();
88
+ const image: string | undefined = $$('div#Content img').first().prop('src');
89
+
90
+ const mediaContent: Cheerio<Element> = $$('div#Content p span img');
91
+ const media: Record<string, Record<string, string>> = {};
92
+
93
+ if (mediaContent.length) {
94
+ mediaContent.each((_, el) => {
95
+ const $$el: Cheerio<Element> = $$(el);
96
+
97
+ const pEl: Cheerio<Element> = $$el.closest('p');
98
+
99
+ const mediaUrl: string | undefined = $$el.prop('src');
100
+ const mediaType: string | undefined = mediaUrl?.split(/\./).pop();
101
+
102
+ if (mediaType && mediaUrl) {
103
+ media[mediaType] = { url: mediaUrl };
104
+
105
+ pEl.replaceWith(
106
+ art(path.join(__dirname, 'templates/description.art'), {
107
+ images: [
108
+ {
109
+ src: mediaUrl,
110
+ },
111
+ ],
112
+ })
113
+ );
114
+ }
115
+ });
116
+ }
117
+
118
+ const description: string = art(path.join(__dirname, 'templates/description.art'), {
119
+ description: $$('div#Content').html() ?? '',
120
+ });
121
+
122
+ const extraLinks = $$('div.extend_read ul li a')
123
+ .toArray()
124
+ .map((el) => {
125
+ const $$el: Cheerio<Element> = $$(el);
126
+
127
+ return {
128
+ url: $$el.prop('href'),
129
+ type: 'related',
130
+ content_html: $$el.prop('title') || $$el.text(),
131
+ };
132
+ })
133
+ .filter((_): _ is { url: string; type: string; content_html: string } => true);
134
+
135
+ return {
136
+ title,
137
+ description,
138
+ pubDate: timezone(parseDate($$('div.newstag_l').text().split(/\s/)[0]), +8),
139
+ author: item.author,
140
+ content: {
141
+ html: description,
142
+ text: $$('div#Content').html() ?? '',
143
+ },
144
+ image,
145
+ banner: image,
146
+ language,
147
+ media: Object.keys(media).length > 0 ? media : undefined,
148
+ _extra: {
149
+ links: extraLinks.length > 0 ? extraLinks : undefined,
150
+ },
151
+ };
152
+ } catch {
153
+ return item;
154
+ }
155
+ });
156
+ })
157
+ )
158
+ ).filter((_): _ is DataItem => true);
159
+
160
+ const author = '游侠网';
161
+ const title = $('div.news-list-title').text();
162
+ const feedImage = new URL('news/images/ali213_app_big.png', rootUrl).href;
163
+
164
+ return {
165
+ title: `${author} - ${title}`,
166
+ description: title,
167
+ link: targetUrl,
168
+ item: items,
169
+ allowEmpty: true,
170
+ image: feedImage,
171
+ author,
172
+ language,
173
+ id: targetUrl,
174
+ };
175
+ };
176
+
177
+ export const route: Route = {
178
+ path: '/news/:category?',
179
+ name: '资讯',
180
+ url: 'www.ali213.net',
181
+ maintainers: ['nczitzk'],
182
+ handler,
183
+ example: '/ali213/news/new',
184
+ parameters: {
185
+ category: '分类,默认为 `new`,即最新资讯,可在对应分类页 URL 中找到',
186
+ },
187
+ description: `:::tip
188
+ 若订阅 [游戏资讯](https://www.ali213.net/news/game/),网址为 \`https://www.ali213.net/news/game/\`,请截取 \`https://www.ali213.net/news/\` 到末尾 \`/\` 的部分 \`game\` 作为 \`category\` 参数填入,此时目标路由为 [\`/ali213/news/game\`](https://rsshub.app/ali213/news/game)。
189
+ :::
190
+
191
+ | 分类名称 | 分类 ID |
192
+ | -------- | ------- |
193
+ | 最新资讯 | new |
194
+ | 评测 | pingce |
195
+ | 游戏 | game |
196
+ | 动漫 | comic |
197
+ | 影视 | movie |
198
+ | 科技 | tech |
199
+ | 电竞 | esports |
200
+ | 娱乐 | amuse |
201
+ | 手游 | mobile |
202
+ `,
203
+ categories: ['game'],
204
+ features: {
205
+ requireConfig: false,
206
+ requirePuppeteer: false,
207
+ antiCrawler: false,
208
+ supportRadar: true,
209
+ supportBT: false,
210
+ supportPodcast: false,
211
+ supportScihub: false,
212
+ },
213
+ radar: [
214
+ {
215
+ source: ['www.ali213.net/news/:category'],
216
+ target: (params) => {
217
+ const category = params.category;
218
+
219
+ return `/news/${category ? `/${category}` : ''}`;
220
+ },
221
+ },
222
+ {
223
+ title: '最新资讯',
224
+ source: ['www.ali213.net/news/new'],
225
+ target: '/news/new',
226
+ },
227
+ {
228
+ title: '评测',
229
+ source: ['www.ali213.net/news/pingce'],
230
+ target: '/news/pingce',
231
+ },
232
+ {
233
+ title: '游戏',
234
+ source: ['www.ali213.net/news/game'],
235
+ target: '/news/game',
236
+ },
237
+ {
238
+ title: '动漫',
239
+ source: ['www.ali213.net/news/comic'],
240
+ target: '/news/comic',
241
+ },
242
+ {
243
+ title: '影视',
244
+ source: ['www.ali213.net/news/movie'],
245
+ target: '/news/movie',
246
+ },
247
+ {
248
+ title: '科技',
249
+ source: ['www.ali213.net/news/tech'],
250
+ target: '/news/tech',
251
+ },
252
+ {
253
+ title: '电竞',
254
+ source: ['www.ali213.net/news/esports'],
255
+ target: '/news/esports',
256
+ },
257
+ {
258
+ title: '娱乐',
259
+ source: ['www.ali213.net/news/amuse'],
260
+ target: '/news/amuse',
261
+ },
262
+ {
263
+ title: '手游',
264
+ source: ['www.ali213.net/news/mobile'],
265
+ target: '/news/mobile',
266
+ },
267
+ ],
268
+ view: ViewType.Articles,
269
+ };
@@ -0,0 +1,21 @@
1
+ {{ if images }}
2
+ {{ each images image }}
3
+ {{ if image?.src }}
4
+ <figure>
5
+ <img
6
+ {{ if image.alt }}
7
+ alt="{{ image.alt }}"
8
+ {{ /if }}
9
+ src="{{ image.src }}">
10
+ </figure>
11
+ {{ /if }}
12
+ {{ /each }}
13
+ {{ /if }}
14
+
15
+ {{ if intro }}
16
+ <blockquote>{{ intro }}</blockquote>
17
+ {{ /if }}
18
+
19
+ {{ if description }}
20
+ {{@ description }}
21
+ {{ /if }}