rsshub 1.0.0-master.b76ffa1 → 1.0.0-master.b77ea8a

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 (71) hide show
  1. package/lib/config.ts +3 -0
  2. package/lib/middleware/access-control.ts +1 -1
  3. package/lib/routes/afdian/dynamic.ts +1 -1
  4. package/lib/routes/afdian/explore.ts +1 -1
  5. package/lib/routes/bilibili/bangumi.ts +45 -43
  6. package/lib/routes/bilibili/bilibili-recommend.ts +4 -4
  7. package/lib/routes/bilibili/coin.ts +4 -4
  8. package/lib/routes/bilibili/dynamic.ts +14 -14
  9. package/lib/routes/bilibili/fav.ts +4 -4
  10. package/lib/routes/bilibili/followings-dynamic.ts +25 -3
  11. package/lib/routes/bilibili/followings-video.ts +4 -4
  12. package/lib/routes/bilibili/like.ts +4 -4
  13. package/lib/routes/bilibili/page.ts +5 -4
  14. package/lib/routes/bilibili/partion-ranking.ts +4 -4
  15. package/lib/routes/bilibili/partion.ts +4 -4
  16. package/lib/routes/bilibili/popular.ts +6 -4
  17. package/lib/routes/bilibili/ranking.ts +4 -6
  18. package/lib/routes/bilibili/templates/description.art +12 -0
  19. package/lib/routes/bilibili/types.ts +52 -0
  20. package/lib/routes/bilibili/user-channel.ts +10 -17
  21. package/lib/routes/bilibili/user-collection.ts +10 -18
  22. package/lib/routes/bilibili/user-fav.ts +4 -4
  23. package/lib/routes/bilibili/utils.ts +111 -7
  24. package/lib/routes/bilibili/video-all.ts +8 -3
  25. package/lib/routes/bilibili/video.ts +5 -4
  26. package/lib/routes/bilibili/vsearch.ts +21 -5
  27. package/lib/routes/bilibili/watchlater.ts +4 -4
  28. package/lib/routes/bilibili/weekly-recommend.ts +4 -9
  29. package/lib/routes/bsky/posts.ts +2 -2
  30. package/lib/routes/bsky/templates/post.art +4 -2
  31. package/lib/routes/chinania/index.ts +240 -0
  32. package/lib/routes/chinania/namespace.ts +8 -0
  33. package/lib/routes/dedao/articles.ts +149 -0
  34. package/lib/routes/eshukan/academic.ts +134 -0
  35. package/lib/routes/eshukan/namespace.ts +8 -0
  36. package/lib/routes/eshukan/templates/description.art +7 -0
  37. package/lib/routes/follow/profile.ts +37 -3
  38. package/lib/routes/lovelive-anime/schedules.ts +4 -5
  39. package/lib/routes/lovelive-anime/topics.ts +88 -37
  40. package/lib/routes/mingpao/index.ts +7 -1
  41. package/lib/routes/nature/cover.ts +5 -3
  42. package/lib/routes/nature/research.ts +1 -1
  43. package/lib/routes/nature/siteindex.ts +25 -11
  44. package/lib/routes/nature/utils.ts +5 -7
  45. package/lib/routes/qq/pd/guild.ts +146 -0
  46. package/lib/routes/qq/pd/types.ts +82 -0
  47. package/lib/routes/qq/pd/utils.ts +119 -0
  48. package/lib/routes/reuters/common.ts +160 -159
  49. package/lib/routes/reuters/investigates.ts +3 -2
  50. package/lib/routes/rsshub/transform/html.ts +2 -2
  51. package/lib/routes/telegram/channel.ts +14 -5
  52. package/lib/routes/telegram/scripts/get-telegram-session.mjs +41 -0
  53. package/lib/routes/telegram/tglib/channel.ts +8 -4
  54. package/lib/routes/theinitium/app.ts +49 -27
  55. package/lib/routes/theinitium/templates/description.art +2 -2
  56. package/lib/routes/threads/index.ts +1 -1
  57. package/lib/routes/threads/utils.ts +19 -1
  58. package/lib/routes/twitter/api/mobile-api/login.ts +125 -127
  59. package/lib/routes/twitter/api/mobile-api/token.ts +2 -0
  60. package/lib/routes/twitter/home-latest.ts +4 -1
  61. package/lib/routes/twitter/home.ts +4 -1
  62. package/lib/routes/twitter/likes.ts +4 -1
  63. package/lib/routes/twitter/list.ts +4 -1
  64. package/lib/routes/twitter/namespace.ts +1 -0
  65. package/lib/routes/twitter/utils.ts +9 -3
  66. package/lib/routes/warthunder/news.ts +8 -8
  67. package/lib/routes/washingtonpost/app.ts +118 -0
  68. package/lib/routes/washingtonpost/namespace.ts +6 -0
  69. package/lib/routes/washingtonpost/templates/description.art +59 -0
  70. package/lib/routes/zhihu/daily.ts +30 -64
  71. package/package.json +12 -12
@@ -0,0 +1,240 @@
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 { category = 'xiehuidongtai/xiehuitongzhi' } = ctx.req.param();
10
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 25;
11
+
12
+ const rootUrl = 'https://www.chinania.org.cn';
13
+ const currentUrl = new URL(`html/${category.endsWith('/') ? category : `${category}/`}`, rootUrl).href;
14
+
15
+ const { data: response } = await got(currentUrl);
16
+
17
+ const $ = load(response);
18
+
19
+ const language = $('html').prop('lang');
20
+
21
+ let items = $('ul.notice_list_ul li')
22
+ .slice(0, limit)
23
+ .toArray()
24
+ .map((item) => {
25
+ item = $(item);
26
+
27
+ return {
28
+ title: item.find('p').first().text(),
29
+ pubDate: parseDate(item.find('p').last().text()),
30
+ link: item.find('a').prop('href'),
31
+ language,
32
+ };
33
+ });
34
+
35
+ items = await Promise.all(
36
+ items.map((item) =>
37
+ cache.tryGet(item.link, async () => {
38
+ const { data: detailResponse } = await got(item.link);
39
+
40
+ const $$ = load(detailResponse);
41
+
42
+ const title = $$('div.article_title p').first().text();
43
+ const description = $$('div.article_content').html();
44
+
45
+ item.title = title;
46
+ item.description = description;
47
+ item.pubDate = parseDate($$('div.article_title p').last().text().split(':'));
48
+ item.author = $$("meta[name='keywords']").prop('content');
49
+ item.content = {
50
+ html: description,
51
+ text: $$('div.article_content').text(),
52
+ };
53
+ item.language = language;
54
+
55
+ return item;
56
+ })
57
+ )
58
+ );
59
+
60
+ const title = $('title').text();
61
+ const image = new URL($('img.logo').prop('src'), rootUrl).href;
62
+
63
+ return {
64
+ title,
65
+ description: title.split(/-/)[0]?.trim(),
66
+ link: currentUrl,
67
+ item: items,
68
+ allowEmpty: true,
69
+ image,
70
+ author: $("meta[name='keywords']").prop('content'),
71
+ language,
72
+ };
73
+ };
74
+
75
+ export const route: Route = {
76
+ path: '/:category{.+}?',
77
+ name: '分类',
78
+ url: 'www.chinania.org.cn',
79
+ maintainers: ['nczitzk'],
80
+ handler,
81
+ example: '/chinania/xiehuidongtai/xiehuitongzhi',
82
+ parameters: { category: '分类,默认为 `xiehuidongtai/xiehuitongzhi`,即协会通知,可在对应分类页 URL 中找到' },
83
+ description: `:::tip
84
+ 若订阅 [协会通知](https://www.chinania.org.cn/html/xiehuidongtai/xiehuitongzhi/),网址为 \`https://www.chinania.org.cn/html/xiehuidongtai/xiehuitongzhi/\`。截取 \`https://www.chinania.org.cn/html\` 到末尾 \`/\` 的部分 \`xiehuidongtai/xiehuitongzhi\` 作为参数填入,此时路由为 [\`/chinania/xiehuidongtai/xiehuitongzhi\`](https://rsshub.app/chinania/xiehuidongtai/xiehuitongzhi)。
85
+ :::
86
+
87
+ <details>
88
+ <summary>更多分类</summary>
89
+
90
+ #### [协会动态](https://www.chinania.org.cn/html/xiehuidongtai/)
91
+
92
+ | [协会动态](https://www.chinania.org.cn/html/xiehuidongtai/xiehuidongtai/) | [协会通知](https://www.chinania.org.cn/html/xiehuidongtai/xiehuitongzhi/) | [有色企业50强](https://www.chinania.org.cn/html/xiehuidongtai/youseqiye50qiang/) |
93
+ | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
94
+ | [xiehuidongtai/xiehuidongtai](https://rsshub.app/chinania/xiehuidongtai/xiehuidongtai) | [xiehuidongtai/xiehuitongzhi](https://rsshub.app/chinania/xiehuidongtai/xiehuitongzhi) | [xiehuidongtai/youseqiye50qiang](https://rsshub.app/chinania/xiehuidongtai/youseqiye50qiang) |
95
+
96
+ #### [党建工作](https://www.chinania.org.cn/html/djgz/)
97
+
98
+ | [协会党建](https://www.chinania.org.cn/html/djgz/xiehuidangjian/) | [行业党建](https://www.chinania.org.cn/html/djgz/hangyedangjian/) |
99
+ | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
100
+ | [djgz/xiehuidangjian](https://rsshub.app/chinania/djgz/xiehuidangjian) | [djgz/hangyedangjian](https://rsshub.app/chinania/djgz/hangyedangjian) |
101
+
102
+ #### [行业新闻](https://www.chinania.org.cn/html/hangyexinwen/)
103
+
104
+ | [时政要闻](https://www.chinania.org.cn/html/hangyexinwen/shizhengyaowen/) | [要闻](https://www.chinania.org.cn/html/hangyexinwen/yaowen/) | [行业新闻](https://www.chinania.org.cn/html/hangyexinwen/guoneixinwen/) | [资讯](https://www.chinania.org.cn/html/hangyexinwen/zixun/) |
105
+ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
106
+ | [hangyexinwen/shizhengyaowen](https://rsshub.app/chinania/hangyexinwen/shizhengyaowen) | [hangyexinwen/yaowen](https://rsshub.app/chinania/hangyexinwen/yaowen) | [hangyexinwen/guoneixinwen](https://rsshub.app/chinania/hangyexinwen/guoneixinwen) | [hangyexinwen/zixun](https://rsshub.app/chinania/hangyexinwen/zixun) |
107
+
108
+ #### [人力资源](https://www.chinania.org.cn/html/renliziyuan/)
109
+
110
+ | [相关通知](https://www.chinania.org.cn/html/renliziyuan/xiangguantongzhi/) | [人事招聘](https://www.chinania.org.cn/html/renliziyuan/renshizhaopin/) |
111
+ | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
112
+ | [renliziyuan/xiangguantongzhi](https://rsshub.app/chinania/renliziyuan/xiangguantongzhi) | [renliziyuan/renshizhaopin](https://rsshub.app/chinania/renliziyuan/renshizhaopin) |
113
+
114
+ #### [行业统计](https://www.chinania.org.cn/html/hangyetongji/jqzs/)
115
+
116
+ | [行业分析](https://www.chinania.org.cn/html/hangyetongji/tongji/) | [数据统计](https://www.chinania.org.cn/html/hangyetongji/chanyeshuju/) | [景气指数](https://www.chinania.org.cn/html/hangyetongji/jqzs/) |
117
+ | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
118
+ | [hangyetongji/tongji](https://rsshub.app/chinania/hangyetongji/tongji) | [hangyetongji/chanyeshuju](https://rsshub.app/chinania/hangyetongji/chanyeshuju) | [hangyetongji/jqzs](https://rsshub.app/chinania/hangyetongji/jqzs) |
119
+
120
+ #### [政策法规](https://www.chinania.org.cn/html/zcfg/zhengcefagui/)
121
+
122
+ | [政策法规](https://www.chinania.org.cn/html/zcfg/zhengcefagui/) |
123
+ | ------------------------------------------------------------------ |
124
+ | [zcfg/zhengcefagui](https://rsshub.app/chinania/zcfg/zhengcefagui) |
125
+
126
+ #### [会议展览](https://www.chinania.org.cn/html/hyzl/huiyizhanlan/)
127
+
128
+ | [会展通知](https://www.chinania.org.cn/html/hyzl/huiyizhanlan/) | [会展报道](https://www.chinania.org.cn/html/hyzl/huizhanbaodao/) |
129
+ | ------------------------------------------------------------------ | -------------------------------------------------------------------- |
130
+ | [hyzl/huiyizhanlan](https://rsshub.app/chinania/hyzl/huiyizhanlan) | [hyzl/huizhanbaodao](https://rsshub.app/chinania/hyzl/huizhanbaodao) |
131
+
132
+ </details>
133
+ `,
134
+ categories: ['new-media'],
135
+
136
+ features: {
137
+ requireConfig: false,
138
+ requirePuppeteer: false,
139
+ antiCrawler: false,
140
+ supportRadar: true,
141
+ supportBT: false,
142
+ supportPodcast: false,
143
+ supportScihub: false,
144
+ },
145
+ radar: [
146
+ {
147
+ source: ['www.chinania.org.cn/html/:category'],
148
+ target: (params) => {
149
+ const category = params.category;
150
+
151
+ return category ? `/${category}` : '';
152
+ },
153
+ },
154
+ {
155
+ title: '协会动态 - 协会动态',
156
+ source: ['www.chinania.org.cn/html/xiehuidongtai/xiehuidongtai/'],
157
+ target: '/xiehuidongtai/xiehuidongtai',
158
+ },
159
+ {
160
+ title: '协会动态 - 协会通知',
161
+ source: ['www.chinania.org.cn/html/xiehuidongtai/xiehuitongzhi/'],
162
+ target: '/xiehuidongtai/xiehuitongzhi',
163
+ },
164
+ {
165
+ title: '协会动态 - 有色企业50强',
166
+ source: ['www.chinania.org.cn/html/xiehuidongtai/youseqiye50qiang/'],
167
+ target: '/xiehuidongtai/youseqiye50qiang',
168
+ },
169
+ {
170
+ title: '党建工作 - 协会党建',
171
+ source: ['www.chinania.org.cn/html/djgz/xiehuidangjian/'],
172
+ target: '/djgz/xiehuidangjian',
173
+ },
174
+ {
175
+ title: '党建工作 - 行业党建',
176
+ source: ['www.chinania.org.cn/html/djgz/hangyedangjian/'],
177
+ target: '/djgz/hangyedangjian',
178
+ },
179
+ {
180
+ title: '会议展览 - 会展通知',
181
+ source: ['www.chinania.org.cn/html/hyzl/huiyizhanlan/'],
182
+ target: '/hyzl/huiyizhanlan',
183
+ },
184
+ {
185
+ title: '会议展览 - 会展报道',
186
+ source: ['www.chinania.org.cn/html/hyzl/huizhanbaodao/'],
187
+ target: '/hyzl/huizhanbaodao',
188
+ },
189
+ {
190
+ title: '行业新闻 - 时政要闻',
191
+ source: ['www.chinania.org.cn/html/hangyexinwen/shizhengyaowen/'],
192
+ target: '/hangyexinwen/shizhengyaowen',
193
+ },
194
+ {
195
+ title: '行业新闻 - 要闻',
196
+ source: ['www.chinania.org.cn/html/hangyexinwen/yaowen/'],
197
+ target: '/hangyexinwen/yaowen',
198
+ },
199
+ {
200
+ title: '行业新闻 - 行业新闻',
201
+ source: ['www.chinania.org.cn/html/hangyexinwen/guoneixinwen/'],
202
+ target: '/hangyexinwen/guoneixinwen',
203
+ },
204
+ {
205
+ title: '行业新闻 - 资讯',
206
+ source: ['www.chinania.org.cn/html/hangyexinwen/zixun/'],
207
+ target: '/hangyexinwen/zixun',
208
+ },
209
+ {
210
+ title: '行业统计 - 行业分析',
211
+ source: ['www.chinania.org.cn/html/hangyetongji/tongji/'],
212
+ target: '/hangyetongji/tongji',
213
+ },
214
+ {
215
+ title: '行业统计 - 数据统计',
216
+ source: ['www.chinania.org.cn/html/hangyetongji/chanyeshuju/'],
217
+ target: '/hangyetongji/chanyeshuju',
218
+ },
219
+ {
220
+ title: '行业统计 - 景气指数',
221
+ source: ['www.chinania.org.cn/html/hangyetongji/jqzs/'],
222
+ target: '/hangyetongji/jqzs',
223
+ },
224
+ {
225
+ title: '人力资源 - 相关通知',
226
+ source: ['www.chinania.org.cn/html/renliziyuan/xiangguantongzhi/'],
227
+ target: '/renliziyuan/xiangguantongzhi',
228
+ },
229
+ {
230
+ title: '人力资源 - 人事招聘',
231
+ source: ['www.chinania.org.cn/html/renliziyuan/renshizhaopin/'],
232
+ target: '/renliziyuan/renshizhaopin',
233
+ },
234
+ {
235
+ title: '政策法规 - 政策法规',
236
+ source: ['www.chinania.org.cn/html/zcfg/zhengcefagui/'],
237
+ target: '/zcfg/zhengcefagui',
238
+ },
239
+ ],
240
+ };
@@ -0,0 +1,8 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '中国有色金属工业网',
5
+ url: 'chinania.org.cn',
6
+ categories: ['new-media'],
7
+ description: '',
8
+ };
@@ -0,0 +1,149 @@
1
+ import { Route } from '@/types';
2
+ import cache from '@/utils/cache';
3
+ import got from '@/utils/got';
4
+ import { load } from 'cheerio';
5
+
6
+ export const route: Route = {
7
+ path: '/articles/:id?',
8
+ categories: ['new-media'],
9
+ example: '/articles/9', // 示例路径更新
10
+ parameters: { id: '文章类型 ID,8 为得到头条,9 为得到精选,默认为 8' },
11
+ features: {
12
+ requireConfig: false,
13
+ requirePuppeteer: false,
14
+ antiCrawler: false,
15
+ supportBT: false,
16
+ supportPodcast: false,
17
+ supportScihub: false,
18
+ },
19
+ radar: [
20
+ {
21
+ source: ['igetget.com'],
22
+ target: '/articles/:id',
23
+ },
24
+ ],
25
+ name: '得到文章',
26
+ maintainers: ['Jacky-Chen-Pro'],
27
+ handler,
28
+ url: 'www.igetget.com',
29
+ };
30
+
31
+ function handleParagraph(data) {
32
+ let html = '<p>';
33
+ if (data.contents && Array.isArray(data.contents)) {
34
+ html += data.contents.map((data) => extractArticleContent(data)).join('');
35
+ }
36
+ html += '</p>';
37
+ return html;
38
+ }
39
+
40
+ function handleText(data) {
41
+ let content = data.text?.content || '';
42
+ if (data.text?.bold || data.text?.highlight) {
43
+ content = `<strong>${content}</strong>`;
44
+ }
45
+ return content;
46
+ }
47
+
48
+ function handleImage(data) {
49
+ return data.image?.src ? `<img src="${data.image.src}" alt="${data.image.alt || ''}" />` : '';
50
+ }
51
+
52
+ function handleHr() {
53
+ return '<hr />';
54
+ }
55
+
56
+ function extractArticleContent(data) {
57
+ if (!data || typeof data !== 'object') {
58
+ return '';
59
+ }
60
+
61
+ switch (data.type) {
62
+ case 'paragraph':
63
+ return handleParagraph(data);
64
+ case 'text':
65
+ return handleText(data);
66
+ case 'image':
67
+ return handleImage(data);
68
+ case 'hr':
69
+ return handleHr();
70
+ default:
71
+ return '';
72
+ }
73
+ }
74
+
75
+ async function handler(ctx) {
76
+ const { id = '8' } = ctx.req.param();
77
+ const rootUrl = 'https://www.igetget.com';
78
+ const headers = {
79
+ Accept: 'application/json, text/plain, */*',
80
+ 'Content-Type': 'application/json;charset=UTF-8',
81
+ Referer: `https://m.igetget.com/share/course/free/detail?id=nb9L2q1e3OxKBPNsdoJrgN8P0Rwo6B`,
82
+ Origin: 'https://m.igetget.com',
83
+ };
84
+ const max_id = 0;
85
+
86
+ const response = await got.post('https://m.igetget.com/share/api/course/free/pageTurning', {
87
+ json: {
88
+ chapter_id: 0,
89
+ count: 5,
90
+ max_id,
91
+ max_order_num: 0,
92
+ pid: Number(id),
93
+ ptype: 24,
94
+ reverse: true,
95
+ since_id: 0,
96
+ since_order_num: 0,
97
+ },
98
+ headers,
99
+ });
100
+
101
+ const data = JSON.parse(response.body);
102
+ if (!data || !data.article_list) {
103
+ throw new Error('文章列表不存在或为空');
104
+ }
105
+
106
+ const articles = data.article_list;
107
+
108
+ const items = await Promise.all(
109
+ articles.map((article) => {
110
+ const postUrl = `https://m.igetget.com/share/course/article/article_id/${article.id}`;
111
+ const postTitle = article.title;
112
+ const postTime = new Date(article.publish_time * 1000).toUTCString();
113
+
114
+ return cache.tryGet(postUrl, async () => {
115
+ const detailResponse = await got.get(postUrl, { headers });
116
+ const $ = load(detailResponse.body);
117
+
118
+ const scriptTag = $('script')
119
+ .filter((_, el) => $(el).text()?.includes('window.__INITIAL_STATE__'))
120
+ .text();
121
+
122
+ if (scriptTag) {
123
+ const jsonStr = scriptTag.match(/window\.__INITIAL_STATE__\s*=\s*(\{.*\});/)?.[1];
124
+ if (jsonStr) {
125
+ const articleData = JSON.parse(jsonStr);
126
+
127
+ const description = JSON.parse(articleData.articleContent.content)
128
+ .map((data) => extractArticleContent(data))
129
+ .join('');
130
+
131
+ return {
132
+ title: postTitle,
133
+ link: postUrl,
134
+ description,
135
+ pubDate: postTime,
136
+ };
137
+ }
138
+ }
139
+ return null;
140
+ });
141
+ })
142
+ );
143
+
144
+ return {
145
+ title: `得到文章 - ${id === '8' ? '头条' : '精选'}`,
146
+ link: rootUrl,
147
+ item: items.filter(Boolean),
148
+ };
149
+ }
@@ -0,0 +1,134 @@
1
+ import { Route } from '@/types';
2
+ import { getCurrentPath } from '@/utils/helpers';
3
+ const __dirname = getCurrentPath(import.meta.url);
4
+
5
+ import cache from '@/utils/cache';
6
+ import got from '@/utils/got';
7
+ import { load } from 'cheerio';
8
+ import timezone from '@/utils/timezone';
9
+ import { parseDate } from '@/utils/parse-date';
10
+ import { art } from '@/utils/render';
11
+ import path from 'node:path';
12
+
13
+ export const handler = async (ctx) => {
14
+ const { id = '1' } = ctx.req.param();
15
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10;
16
+
17
+ const rootUrl = 'https://www.eshukan.com';
18
+ const currentUrl = new URL(`academic/index.aspx?cid=${id}`, rootUrl).href;
19
+
20
+ const { data: response } = await got(currentUrl);
21
+
22
+ const $ = load(response);
23
+
24
+ let items = $('ul.article li')
25
+ .slice(0, limit)
26
+ .toArray()
27
+ .map((item) => {
28
+ item = $(item);
29
+
30
+ const a = item.find('a');
31
+
32
+ const title = a.contents().last().text();
33
+ const pubDate = item
34
+ .find('p span')
35
+ .text()
36
+ .match(/(\d{4}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2})/)?.[1];
37
+
38
+ item.find('p span').remove();
39
+
40
+ const description = art(path.join(__dirname, 'templates/description.art'), {
41
+ intro: item.find('p').text(),
42
+ });
43
+
44
+ return {
45
+ title,
46
+ description,
47
+ pubDate: pubDate ? timezone(parseDate(pubDate), +8) : undefined,
48
+ link: new URL(a.prop('href'), currentUrl).href,
49
+ content: {
50
+ html: description,
51
+ text: item.find('p').text(),
52
+ },
53
+ };
54
+ });
55
+
56
+ items = await Promise.all(
57
+ items.map((item) =>
58
+ cache.tryGet(item.link, async () => {
59
+ const { data: detailResponse } = await got(item.link);
60
+
61
+ const $$ = load(detailResponse);
62
+
63
+ const title = $$('h1').text();
64
+ const description = art(path.join(__dirname, 'templates/description.art'), {
65
+ intro: $$('div.summary').html(),
66
+ description: $$('div.detail').html(),
67
+ });
68
+ const pubDate = $$('div.author')
69
+ .text()
70
+ .match(/(\d{4}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2})/)?.[1];
71
+
72
+ item.title = title;
73
+ item.description = description;
74
+ item.pubDate = pubDate ? timezone(parseDate(pubDate), +8) : item.pubDate;
75
+ item.author = $$('div.author a').text();
76
+ item.content = {
77
+ html: description,
78
+ text: $$('div.detail').text(),
79
+ };
80
+
81
+ return item;
82
+ })
83
+ )
84
+ );
85
+
86
+ const title = $('title').text();
87
+ const image = new URL($('div.logo img').prop('src'), rootUrl).href;
88
+
89
+ return {
90
+ title,
91
+ description: $('meta[name="description"]').prop('content'),
92
+ link: currentUrl,
93
+ item: items,
94
+ allowEmpty: true,
95
+ image,
96
+ author: title.split(/_/).pop(),
97
+ };
98
+ };
99
+
100
+ export const route: Route = {
101
+ path: '/academic/:id?',
102
+ name: '学术资讯',
103
+ url: 'www.eshukan.com',
104
+ maintainers: ['nczitzk'],
105
+ handler,
106
+ example: '/eshukan/academic/1',
107
+ parameters: { category: '栏目 id,默认为 `1`,即期刊动态,可在对应栏目页 URL 中找到' },
108
+ description: `:::tip
109
+ 若订阅 [期刊动态](https://www.eshukan.com/academic/index.aspx?cid=1),网址为 \`https://www.eshukan.com/academic/index.aspx?cid=1\`。截取 \`https://www.eshukan.com/academic/index.aspx?cid=\` 到末尾的部分 \`1\` 作为参数填入,此时路由为 [\`/eshukan/academic/1\`](https://rsshub.app/eshukan/academic/1)。
110
+ :::
111
+ `,
112
+ categories: ['study'],
113
+
114
+ features: {
115
+ requireConfig: false,
116
+ requirePuppeteer: false,
117
+ antiCrawler: false,
118
+ supportRadar: true,
119
+ supportBT: false,
120
+ supportPodcast: false,
121
+ supportScihub: false,
122
+ },
123
+ radar: [
124
+ {
125
+ source: ['www.eshukan.com/academic/index.aspx'],
126
+ target: (_, url) => {
127
+ url = new URL(url);
128
+ const id = url.searchParams.get('id');
129
+
130
+ return `/academic${id ? `/${id}` : ''}`;
131
+ },
132
+ },
133
+ ],
134
+ };
@@ -0,0 +1,8 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '万维书刊网',
5
+ url: 'eshukan.com',
6
+ categories: ['study'],
7
+ description: '',
8
+ };
@@ -0,0 +1,7 @@
1
+ {{ if intro }}
2
+ <blockquote>{{@ intro }}</blockquote>
3
+ {{ /if }}
4
+
5
+ {{ if description }}
6
+ {{@ description }}
7
+ {{ /if }}
@@ -31,10 +31,18 @@ const isList = (subscription: Subscription): subscription is ListSubscription =>
31
31
  const isInbox = (subscription: Subscription): subscription is InboxSubscription => 'inboxId' in subscription;
32
32
 
33
33
  async function handler(ctx: Context): Promise<Data> {
34
- const uid = ctx.req.param('uid');
34
+ const handleOrId = ctx.req.param('uid');
35
35
  const host = 'https://api.follow.is';
36
36
 
37
- const profile = await ofetch<FollowResponse<Profile>>(`${host}/profiles?id=${uid}`);
37
+ const handle = isBizId(handleOrId || '') ? handleOrId : handleOrId.startsWith('@') ? handleOrId.slice(1) : handleOrId;
38
+
39
+ const searchParams = new URLSearchParams({ handle });
40
+
41
+ if (isBizId(handle || '')) {
42
+ searchParams.append('id', handle);
43
+ }
44
+
45
+ const profile = await ofetch<FollowResponse<Profile>>(`${host}/profiles?${searchParams.toString()}`);
38
46
  const subscriptions = await ofetch<FollowResponse<Subscription[]>>(`${host}/subscriptions?userId=${profile.data.id}`);
39
47
 
40
48
  return {
@@ -56,7 +64,7 @@ async function handler(ctx: Context): Promise<Data> {
56
64
  category: subscription.category ? [subscription.category] : undefined,
57
65
  };
58
66
  }),
59
- link: `https://app.follow.is/profile/${uid}`,
67
+ link: `https://app.follow.is/share/user/${handleOrId}`,
60
68
  image: profile.data.image,
61
69
  };
62
70
  }
@@ -81,3 +89,29 @@ const getUrlIcon = (url: string, fallback?: boolean | undefined) => {
81
89
 
82
90
  return ret;
83
91
  };
92
+
93
+ // referenced from https://github.com/RSSNext/Follow/blob/dev/packages/utils/src/utils.ts
94
+ const EPOCH = 1_712_546_615_000n; // follow repo created
95
+ const MAX_TIMESTAMP_BITS = 41n; // Maximum number of bits typically used for timestamp
96
+ export const isBizId = (id: string): boolean => {
97
+ if (!id || !/^\d{13,19}$/.test(id)) {
98
+ return false;
99
+ }
100
+
101
+ const snowflake = BigInt(id);
102
+
103
+ // Extract the timestamp assuming it's in the most significant bits after the sign bit
104
+ const timestamp = (snowflake >> (63n - MAX_TIMESTAMP_BITS)) + EPOCH;
105
+ const date = new Date(Number(timestamp));
106
+
107
+ // Check if the date is reasonable (between 2024 and 2050)
108
+ if (date.getFullYear() >= 2024 && date.getFullYear() <= 2050) {
109
+ // Additional validation: check if the ID is not larger than the maximum possible value
110
+ const maxPossibleId = (1n << 63n) - 1n; // Maximum possible 63-bit value
111
+ if (snowflake <= maxPossibleId) {
112
+ return true;
113
+ }
114
+ }
115
+
116
+ return false;
117
+ };
@@ -2,7 +2,7 @@ import { Route } from '@/types';
2
2
  import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
5
- import got from '@/utils/got';
5
+ import ofetch from '@/utils/ofetch';
6
6
  import path from 'node:path';
7
7
  import { art } from '@/utils/render';
8
8
  const renderDescription = (desc) => art(path.join(__dirname, 'templates/scheduleDesc.art'), desc);
@@ -33,8 +33,7 @@ export const route: Route = {
33
33
  };
34
34
 
35
35
  async function handler(ctx) {
36
- const serie = ctx.req.param('serie');
37
- const category = ctx.req.param('category');
36
+ const { serie = 'all', category = 'all' } = ctx.req.param();
38
37
  const rootUrl = 'https://www.lovelive-anime.jp/common/api/calendar_list.php';
39
38
  const nowTime = dayjs();
40
39
  const dataPara = {
@@ -47,9 +46,9 @@ async function handler(ctx) {
47
46
  if (category && 'all' !== category) {
48
47
  dataPara.category = [category];
49
48
  }
50
- const response = await got(`${rootUrl}?site=jp&ip=lovelive&data=${JSON.stringify(dataPara)}`);
49
+ const response = await ofetch(`${rootUrl}?site=jp&ip=lovelive&data=${encodeURIComponent(JSON.stringify(dataPara))}`);
51
50
 
52
- const items = response.data.data.schedule_list.map((item) => {
51
+ const items = response.data.schedule_list.map((item) => {
53
52
  const link = item.url.select_url;
54
53
  const title = item.title;
55
54
  const category = item.categories.name;