rsshub 1.0.0-master.e6d4e1e → 1.0.0-master.e6d53dc

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 (241) hide show
  1. package/lib/api/radar/rules/all.ts +3 -6
  2. package/lib/api/radar/rules/one.ts +3 -6
  3. package/lib/config.ts +12 -22
  4. package/lib/errors/index.tsx +1 -1
  5. package/lib/index.ts +1 -1
  6. package/lib/middleware/anti-hotlink.test.ts +191 -6
  7. package/lib/middleware/anti-hotlink.ts +28 -0
  8. package/lib/middleware/parameter.test.ts +22 -5
  9. package/lib/middleware/parameter.ts +47 -17
  10. package/lib/registry.test.ts +8 -0
  11. package/lib/registry.ts +2 -0
  12. package/lib/router.js +0 -3
  13. package/lib/routes/141jav/index.ts +25 -21
  14. package/lib/routes/141ppv/index.ts +24 -20
  15. package/lib/routes/51read/article.ts +82 -0
  16. package/lib/routes/51read/namespace.ts +6 -0
  17. package/lib/routes/5eplay/utils.ts +5 -3
  18. package/lib/routes/agri/index.ts +307 -0
  19. package/lib/routes/agri/namespace.ts +8 -0
  20. package/lib/routes/agri/templates/description.art +21 -0
  21. package/lib/routes/aljazeera/index.ts +2 -2
  22. package/lib/routes/apnews/sitemap.ts +98 -0
  23. package/lib/routes/apnews/utils.ts +7 -5
  24. package/lib/routes/autocentre/index.ts +29 -0
  25. package/lib/routes/autocentre/namespace.ts +7 -0
  26. package/lib/routes/bilibili/api-interface.d.ts +1 -0
  27. package/lib/routes/bilibili/cache.ts +3 -1
  28. package/lib/routes/bilibili/dynamic.ts +7 -9
  29. package/lib/routes/binance/announcement.ts +168 -0
  30. package/lib/routes/binance/types.ts +26 -0
  31. package/lib/routes/bing/daily-wallpaper.ts +1 -1
  32. package/lib/routes/bjnews/cat.ts +43 -0
  33. package/lib/routes/bjnews/column.ts +43 -0
  34. package/lib/routes/bjnews/namespace.ts +6 -0
  35. package/lib/routes/bjnews/utils.ts +19 -0
  36. package/lib/routes/bjx/fd.ts +35 -26
  37. package/lib/routes/buaa/jiaowu.ts +1 -1
  38. package/lib/routes/buaa/lib/space/newbook.ts +171 -0
  39. package/lib/routes/buaa/lib/space/templates/newbook.art +44 -0
  40. package/lib/routes/cccfna/index.ts +2 -2
  41. package/lib/routes/cctv/category.ts +16 -12
  42. package/lib/routes/cctv/xwlb.ts +32 -10
  43. package/lib/routes/cdu/jwgg.ts +79 -0
  44. package/lib/routes/cdu/namespace.ts +6 -0
  45. package/lib/routes/cffex/announcement.ts +73 -0
  46. package/lib/routes/cffex/namespace.ts +6 -0
  47. package/lib/routes/chlinlearn/daily-blog.ts +55 -0
  48. package/lib/routes/chlinlearn/namespcae.ts +6 -0
  49. package/lib/routes/copymanga/comic.ts +3 -1
  50. package/lib/routes/devolverdigital/blog.ts +59 -42
  51. package/lib/routes/digitalcameraworld/news.ts +1 -1
  52. package/lib/routes/discord/channel.ts +10 -10
  53. package/lib/routes/discord/discord-api.ts +27 -32
  54. package/lib/routes/discord/templates/message.art +15 -0
  55. package/lib/routes/discourse/notifications.ts +2 -1
  56. package/lib/routes/dongqiudi/result.ts +1 -1
  57. package/lib/routes/eastmoney/report/index.ts +63 -15
  58. package/lib/routes/eastmoney/templates/stock_description.art +36 -0
  59. package/lib/routes/eastmoney/utils.ts +35 -0
  60. package/lib/routes/fediverse/timeline.ts +35 -18
  61. package/lib/routes/flashcat/blog.ts +61 -0
  62. package/lib/routes/flashcat/namespace.ts +6 -0
  63. package/lib/routes/ftm/index.ts +60 -0
  64. package/lib/routes/ftm/namespace.ts +6 -0
  65. package/lib/routes/galxe/index.ts +94 -0
  66. package/lib/routes/galxe/namespace.ts +9 -0
  67. package/lib/routes/gamersky/ent.ts +57 -0
  68. package/lib/routes/gamersky/namespace.ts +10 -0
  69. package/lib/routes/gamersky/news.ts +91 -0
  70. package/lib/routes/gamersky/review.ts +80 -0
  71. package/lib/routes/gamersky/utils.ts +94 -0
  72. package/lib/routes/gdut/oa-news.ts +12 -17
  73. package/lib/routes/gisreportsonline/index.ts +60 -0
  74. package/lib/routes/gisreportsonline/namespace.ts +6 -0
  75. package/lib/routes/github/activity.ts +4 -3
  76. package/lib/routes/github/search.ts +20 -18
  77. package/lib/routes/google/research.ts +45 -0
  78. package/lib/routes/gov/cbirc/index.ts +371 -0
  79. package/lib/routes/gov/chongqing/sydwgkzp.ts +4 -4
  80. package/lib/routes/gov/lswz/index.ts +289 -0
  81. package/lib/routes/gov/zj/ningbogzw-notice.ts +50 -0
  82. package/lib/routes/gov/zj/ningborsjnotice.ts +50 -0
  83. package/lib/routes/gq/news.ts +1 -1
  84. package/lib/routes/gs/developer/blog.ts +58 -0
  85. package/lib/routes/gs/namespace.ts +9 -0
  86. package/lib/routes/healthz.ts +8 -0
  87. package/lib/routes/hket/index.ts +80 -76
  88. package/lib/routes/hottoys/index.ts +63 -0
  89. package/lib/routes/hottoys/namespace.ts +6 -0
  90. package/lib/routes/hust/gs.ts +281 -0
  91. package/lib/routes/hust/namespace.ts +1 -1
  92. package/lib/routes/imhcg/blog.ts +47 -0
  93. package/lib/routes/imhcg/namespace.ts +7 -0
  94. package/lib/routes/imop/namespace.ts +10 -0
  95. package/lib/routes/imop/tianshu.ts +53 -0
  96. package/lib/routes/infzm/hot.ts +39 -0
  97. package/lib/routes/infzm/index.ts +3 -30
  98. package/lib/routes/infzm/utils.ts +34 -0
  99. package/lib/routes/inspirehep/author.ts +46 -0
  100. package/lib/routes/inspirehep/literature.ts +42 -0
  101. package/lib/routes/inspirehep/namespace.ts +7 -0
  102. package/lib/routes/inspirehep/types.ts +210 -0
  103. package/lib/routes/inspirehep/utils.ts +15 -0
  104. package/lib/routes/iwara/subscriptions.ts +1 -1
  105. package/lib/routes/javdb/actors.ts +6 -2
  106. package/lib/routes/joins/chinese.ts +218 -0
  107. package/lib/routes/joins/namespace.ts +8 -0
  108. package/lib/routes/joins/templates/description.art +17 -0
  109. package/lib/routes/juejin/dynamic.ts +114 -0
  110. package/lib/routes/kaopu/news.ts +3 -3
  111. package/lib/routes/kemono/index.ts +21 -0
  112. package/lib/routes/keylol/index.ts +56 -11
  113. package/lib/routes/kurogames/namespace.ts +7 -0
  114. package/lib/routes/kurogames/wutheringwaves/news.ts +59 -0
  115. package/lib/routes/link3/events.ts +86 -0
  116. package/lib/routes/link3/namespace.ts +6 -0
  117. package/lib/routes/link3/profile.ts +143 -0
  118. package/lib/routes/linkedin/cn/renderer.ts +1 -1
  119. package/lib/routes/lmu/jobs.ts +96 -0
  120. package/lib/routes/lmu/namespace.ts +17 -0
  121. package/lib/routes/lmu/templates/jobPosting.art +11 -0
  122. package/lib/routes/mcmod/index.ts +105 -0
  123. package/lib/routes/mcmod/namespace.ts +6 -0
  124. package/lib/routes/mcmod/templates/mod.art +13 -0
  125. package/lib/routes/misskey/user-timeline.ts +42 -0
  126. package/lib/routes/misskey/utils.ts +41 -1
  127. package/lib/routes/nationalgeographic/latest-stories.ts +1 -1
  128. package/lib/routes/nationalgeographic/templates/stories.art +1 -1
  129. package/lib/routes/newyorker/news.ts +24 -17
  130. package/lib/routes/oschina/news.ts +2 -0
  131. package/lib/routes/people/index.ts +4 -2
  132. package/lib/routes/picnob/user.ts +11 -3
  133. package/lib/routes/pixiv/search.ts +20 -1
  134. package/lib/routes/pixiv/utils.ts +3 -3
  135. package/lib/routes/psyche/topic.ts +1 -1
  136. package/lib/routes/psyche/type.ts +1 -1
  137. package/lib/routes/psyche/utils.ts +1 -1
  138. package/lib/routes/questn/community.ts +76 -0
  139. package/lib/routes/questn/events.ts +101 -0
  140. package/lib/routes/questn/namespace.ts +6 -0
  141. package/lib/routes/questn/util.ts +16 -0
  142. package/lib/routes/rebase/geekdaily.ts +35 -0
  143. package/lib/routes/rebase/namespace.ts +6 -0
  144. package/lib/routes/rss3/index.ts +22 -13
  145. package/lib/routes/rss3/interfaces/metadata.ts +67 -0
  146. package/lib/routes/rsshub/routes.ts +18 -12
  147. package/lib/routes/samd/news.ts +1 -1
  148. package/lib/routes/sara/index.ts +1 -1
  149. package/lib/routes/scut/gzic/media.ts +71 -0
  150. package/lib/routes/scut/gzic/news.ts +65 -0
  151. package/lib/routes/scut/gzic/notice.ts +88 -0
  152. package/lib/routes/shiep/config.ts +4 -10
  153. package/lib/routes/shiep/index.ts +9 -9
  154. package/lib/routes/showstart/artist.ts +5 -4
  155. package/lib/routes/showstart/brand.ts +5 -4
  156. package/lib/routes/showstart/event.ts +8 -7
  157. package/lib/routes/showstart/search.ts +43 -9
  158. package/lib/routes/showstart/service.ts +81 -53
  159. package/lib/routes/showstart/site.ts +41 -0
  160. package/lib/routes/showstart/utils.ts +9 -8
  161. package/lib/routes/sis001/author.ts +52 -0
  162. package/lib/routes/sis001/common.ts +38 -0
  163. package/lib/routes/sis001/forum.ts +2 -29
  164. package/lib/routes/sjtu/jwc.ts +4 -1
  165. package/lib/routes/sjtu/namespace.ts +1 -1
  166. package/lib/routes/sjtu/seiee/index.ts +97 -0
  167. package/lib/routes/smzdm/product.ts +86 -0
  168. package/lib/routes/spotify/show.ts +1 -1
  169. package/lib/routes/springer/journal.ts +10 -12
  170. package/lib/routes/sse/sselawsrules.ts +370 -0
  171. package/lib/routes/sspai/author.ts +1 -1
  172. package/lib/routes/sspai/column.ts +1 -1
  173. package/lib/routes/sspai/index.ts +1 -1
  174. package/lib/routes/sspai/matrix.ts +1 -1
  175. package/lib/routes/sspai/series-update.ts +1 -1
  176. package/lib/routes/sspai/tag.ts +1 -1
  177. package/lib/routes/sspai/topic.ts +1 -1
  178. package/lib/routes/sustainabilitymag/articles.ts +2 -0
  179. package/lib/routes/szse/rule.ts +315 -42
  180. package/lib/routes/t66y/index.ts +29 -7
  181. package/lib/routes/taoguba/blog.ts +1 -1
  182. package/lib/routes/taoguba/index.ts +1 -1
  183. package/lib/routes/techcrunch/news.ts +20 -29
  184. package/lib/routes/techcrunch/templates/description.art +7 -0
  185. package/lib/routes/telegram/channel.ts +34 -1
  186. package/lib/routes/test/index.ts +50 -43
  187. package/lib/routes/the/index.ts +210 -0
  188. package/lib/routes/the/namespace.ts +8 -0
  189. package/lib/routes/the/templates/description.art +27 -0
  190. package/lib/routes/the/util.ts +307 -0
  191. package/lib/routes/theblockbeats/index.ts +10 -5
  192. package/lib/routes/towardsdatascience/latest.ts +67 -0
  193. package/lib/routes/towardsdatascience/namespace.ts +6 -0
  194. package/lib/routes/tvb/news.ts +1 -0
  195. package/lib/routes/twitter/api/index.ts +2 -0
  196. package/lib/routes/twitter/api/web-api/api.ts +18 -0
  197. package/lib/routes/twitter/api/web-api/constants.ts +2 -0
  198. package/lib/routes/twitter/api/web-api/login.ts +66 -0
  199. package/lib/routes/twitter/api/web-api/utils.ts +53 -27
  200. package/lib/routes/twitter/home-latest.ts +60 -0
  201. package/lib/routes/twitter/home.ts +1 -1
  202. package/lib/routes/twitter/user.ts +1 -1
  203. package/lib/routes/twitter/utils.ts +4 -1
  204. package/lib/routes/uber/blog.ts +1 -1
  205. package/lib/routes/ustc/scms.ts +97 -0
  206. package/lib/routes/v2ex/xna.ts +55 -0
  207. package/lib/routes/wchscu/namespace.ts +6 -0
  208. package/lib/routes/wchscu/recruit.ts +73 -0
  209. package/lib/routes/xiaohongshu/notes.ts +10 -2
  210. package/lib/routes/xiaohongshu/user.ts +23 -2
  211. package/lib/routes/xidian/cs.ts +143 -0
  212. package/lib/routes/xidian/gr.ts +289 -0
  213. package/lib/routes/xidian/jwc.ts +1 -0
  214. package/lib/routes/xidian/namespace.ts +1 -1
  215. package/lib/routes/yahoo/news/index.ts +1 -0
  216. package/lib/routes/yahoo/news/listid.ts +67 -0
  217. package/lib/routes/yahoo/news/utils.ts +8 -2
  218. package/lib/routes/yicai/carousel.ts +48 -0
  219. package/lib/routes/yicai/utils.ts +23 -17
  220. package/lib/routes/youtube/subscriptions.ts +1 -0
  221. package/lib/routes/yystv/docs.ts +28 -19
  222. package/lib/routes/zhihu/answers.ts +5 -1
  223. package/lib/routes/zhihu/execlib/x-zse-96-v3.ts +2 -0
  224. package/lib/routes/zhihu/namespace.ts +3 -0
  225. package/lib/routes/zhihu/utils.ts +15 -2
  226. package/lib/routes/zsxq/types.ts +9 -0
  227. package/lib/routes/zsxq/utils.ts +4 -3
  228. package/lib/setup.test.ts +1 -1
  229. package/lib/types.ts +6 -0
  230. package/lib/utils/cache/index.ts +8 -0
  231. package/lib/utils/camelcase-keys.spec.ts +127 -0
  232. package/lib/utils/camelcase-keys.ts +27 -0
  233. package/lib/utils/common-utils.ts +1 -0
  234. package/lib/views/error.tsx +3 -3
  235. package/lib/views/index.tsx +4 -3
  236. package/lib/views/layout.tsx +1 -1
  237. package/package.json +46 -44
  238. package/lib/routes/sse/lawandrules.ts +0 -68
  239. package/lib/routes-deprecated/bjnews/news.js +0 -44
  240. package/lib/routes-deprecated/gamersky/ent.js +0 -89
  241. package/lib/routes-deprecated/gamersky/news.js +0 -34
@@ -0,0 +1,60 @@
1
+ import { Route } from '@/types';
2
+
3
+ import { load } from 'cheerio';
4
+ import { parseDate } from '@/utils/parse-date';
5
+ import cache from '@/utils/cache';
6
+ import ofetch from '@/utils/ofetch';
7
+
8
+ export const route: Route = {
9
+ path: '/',
10
+ categories: ['new-media'],
11
+ example: '/ftm',
12
+ parameters: {},
13
+ name: '文章',
14
+ maintainers: ['dzx-dzx'],
15
+ radar: [
16
+ {
17
+ source: ['www.ftm.eu'],
18
+ },
19
+ ],
20
+ handler,
21
+ };
22
+
23
+ async function handler(ctx) {
24
+ const rootUrl = 'https://www.ftm.eu';
25
+ const currentUrl = `${rootUrl}/articles`;
26
+ const response = await ofetch(currentUrl);
27
+
28
+ const $ = load(response);
29
+
30
+ const list = $('.article-card')
31
+ .toArray()
32
+ .map((e) => ({ link: $(e).attr('href'), title: $(e).find('h2').text() }))
33
+ .slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : Infinity);
34
+
35
+ const items = await Promise.all(
36
+ list.map((item) =>
37
+ cache.tryGet(item.link, async () => {
38
+ const content = load(await ofetch(item.link));
39
+ const ldjson = JSON.parse(content('[type="application/ld+json"]:not([data-schema])').text());
40
+
41
+ item.pubDate = parseDate(ldjson.datePublished);
42
+ item.updated = parseDate(ldjson.dateModified);
43
+
44
+ item.author = content("[name='author']")
45
+ .toArray()
46
+ .map((e) => ({ name: $(e).attr('content') }));
47
+ item.category = content('.collection .tab').text().trim() || null;
48
+
49
+ item.description = content('.body').html();
50
+
51
+ return item;
52
+ })
53
+ )
54
+ );
55
+ return {
56
+ title: $('title').text(),
57
+ link: currentUrl,
58
+ item: items,
59
+ };
60
+ }
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Follow The Money',
5
+ url: 'www.ftm.eu',
6
+ };
@@ -0,0 +1,94 @@
1
+ import { Route } from '@/types';
2
+ import { parseDate } from '@/utils/parse-date';
3
+ import ofetch from '@/utils/ofetch';
4
+
5
+ export const route: Route = {
6
+ path: '/quest/:alias',
7
+ name: 'Quest',
8
+ url: 'app.galxe.com',
9
+ maintainers: ['cxheng315'],
10
+ example: '/galxe/quest/MissionWeb3',
11
+ categories: ['other'],
12
+ features: {
13
+ requireConfig: false,
14
+ requirePuppeteer: false,
15
+ antiCrawler: false,
16
+ supportBT: false,
17
+ supportPodcast: false,
18
+ supportScihub: false,
19
+ },
20
+ radar: [
21
+ {
22
+ source: ['app.galxe.com/quest/:alias'],
23
+ target: '/quest/:alias',
24
+ },
25
+ ],
26
+ handler,
27
+ };
28
+
29
+ async function handler(ctx) {
30
+ const url = 'https://graphigo.prd.galaxy.eco/query';
31
+
32
+ const alias = ctx.req.param('alias');
33
+
34
+ const response = await ofetch(url, {
35
+ method: 'POST',
36
+ headers: {
37
+ 'Content-Type': 'application/json',
38
+ },
39
+ body: {
40
+ variables: {
41
+ alias,
42
+ campaignInput: {
43
+ first: ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50,
44
+ excludeChildren: true,
45
+ listType: 'Newest',
46
+ },
47
+ },
48
+ query: `
49
+ query BrowseSpaceCampaigns($id: Int, $alias: String, $campaignInput: ListCampaignInput!) {
50
+ space(id: $id, alias: $alias) {
51
+ id
52
+ name
53
+ alias
54
+ info
55
+ campaigns(input: $campaignInput) {
56
+ list {
57
+ startTime
58
+ endTime
59
+ id
60
+ name
61
+ description
62
+ __typename
63
+ }
64
+ pageInfo {
65
+ endCursor
66
+ hasNextPage
67
+ __typename
68
+ }
69
+ __typename
70
+ }
71
+ __typename
72
+ }
73
+ }
74
+ `,
75
+ },
76
+ });
77
+
78
+ const space = response.data.space;
79
+
80
+ const items = space.campaigns.list.map((campaign) => ({
81
+ title: campaign.name,
82
+ link: `https://app.galxe.com/quest/${alias}/${campaign.id}`,
83
+ description: campaign.description,
84
+ pubDate: campaign.startTime ? parseDate(campaign.startTime * 1000) : null,
85
+ }));
86
+
87
+ return {
88
+ title: space.name,
89
+ description: space.info,
90
+ link: `https://app.galxe.com/quest/${alias}`,
91
+ item: items,
92
+ author: space.alias,
93
+ };
94
+ }
@@ -0,0 +1,9 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Galxe',
5
+ url: 'app.galxe.com',
6
+ zh: {
7
+ name: '銀河',
8
+ },
9
+ };
@@ -0,0 +1,57 @@
1
+ import type { Route } from '@/types';
2
+ import type { Context } from 'hono';
3
+ import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils';
4
+
5
+ const idNameMap = new Map([
6
+ ['all', { title: '热点图文', suffix: 'ent', nodeId: '20107' }],
7
+ ['qw', { title: '趣囧时间', suffix: 'ent/qw', nodeId: '20113' }],
8
+ ['movie', { title: '游民影院', suffix: 'wenku/movie', nodeId: '20111' }],
9
+ ['discovery', { title: '游观天下', suffix: 'ent/discovery', nodeId: '20114' }],
10
+ ['wp', { title: '壁纸图库', suffix: 'ent/wp', nodeId: '20117' }],
11
+ ['wenku', { title: '游民盘点', suffix: 'wenku', nodeId: '20106' }],
12
+ ['xz', { title: '游民福利', suffix: 'ent/xz', nodeId: '20119' }],
13
+ ]);
14
+
15
+ export const route: Route = {
16
+ path: '/ent/:category?',
17
+ categories: ['game'],
18
+ example: '/gamersky/ent/xz',
19
+ parameters: {
20
+ type: '分类类型,留空为 `all`',
21
+ },
22
+ features: {
23
+ requireConfig: false,
24
+ requirePuppeteer: false,
25
+ antiCrawler: false,
26
+ supportBT: false,
27
+ supportPodcast: false,
28
+ supportScihub: false,
29
+ },
30
+ radar: Object.entries(idNameMap).map(([type, { title, suffix }]) => ({
31
+ title,
32
+ source: [`www.gamersky.com/${suffix}`],
33
+ target: `/ent/${type}`,
34
+ })),
35
+ name: '娱乐',
36
+ maintainers: ['LogicJake'],
37
+ description: mdTableBuilder(Object.entries(idNameMap).map(([type, { title, nodeId }]) => ({ type, name: title, nodeId }))),
38
+ handler,
39
+ };
40
+
41
+ async function handler(ctx: Context) {
42
+ const category = ctx.req.param('category') ?? 'all';
43
+
44
+ const idName = idNameMap.get(category);
45
+ if (!idName) {
46
+ throw new Error(`Invalid type: ${category}`);
47
+ }
48
+
49
+ const response = await getArticleList(idName.nodeId);
50
+ const list = parseArticleList(response);
51
+ const fullTextList = await Promise.all(list.map((item) => getArticle(item)));
52
+ return {
53
+ title: `${idName.title} - 游民娱乐`,
54
+ link: `https://www.gamersky.com/${idName.suffix}`,
55
+ item: fullTextList,
56
+ };
57
+ }
@@ -0,0 +1,10 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'GamerSky',
5
+ url: 'gamersky.com',
6
+
7
+ zh: {
8
+ name: '游民星空',
9
+ },
10
+ };
@@ -0,0 +1,91 @@
1
+ import type { Route } from '@/types';
2
+ import type { Context } from 'hono';
3
+ import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils';
4
+
5
+ const idNameMap = [
6
+ {
7
+ type: 'today',
8
+ name: '今日推荐',
9
+ nodeId: '11007',
10
+ },
11
+ {
12
+ name: '单机电玩',
13
+ type: 'pc',
14
+ nodeId: '129',
15
+ },
16
+ {
17
+ name: 'NS',
18
+ type: 'ns',
19
+ nodeId: '21160',
20
+ },
21
+ {
22
+ name: '手游',
23
+ type: 'mobile',
24
+ nodeId: '20260',
25
+ },
26
+ {
27
+ name: '网游',
28
+ type: 'web',
29
+ nodeId: '20225',
30
+ },
31
+ {
32
+ name: '业界',
33
+ type: 'industry',
34
+ nodeId: '21163',
35
+ },
36
+ {
37
+ name: '硬件',
38
+ type: 'hardware',
39
+ nodeId: '20070',
40
+ },
41
+ {
42
+ name: '科技',
43
+ type: 'tech',
44
+ nodeId: '20547',
45
+ },
46
+ ];
47
+
48
+ export const route: Route = {
49
+ path: '/news/:type?',
50
+ categories: ['game'],
51
+ example: '/gamersky/news/pc',
52
+ parameters: {
53
+ type: '资讯类型,见表,默认为 `pc`',
54
+ },
55
+ features: {
56
+ requireConfig: false,
57
+ requirePuppeteer: false,
58
+ antiCrawler: false,
59
+ supportBT: false,
60
+ supportPodcast: false,
61
+ supportScihub: false,
62
+ },
63
+ radar: [
64
+ {
65
+ source: ['www.gamersky.com/news'],
66
+ target: '/news',
67
+ },
68
+ ],
69
+ name: '资讯',
70
+ maintainers: ['yy4382'],
71
+ description: mdTableBuilder(idNameMap),
72
+ handler,
73
+ };
74
+
75
+ async function handler(ctx: Context) {
76
+ const type = ctx.req.param('type') ?? 'pc';
77
+
78
+ const idName = idNameMap.find((item) => item.type === type);
79
+ if (!idName) {
80
+ throw new Error(`Invalid type: ${type}`);
81
+ }
82
+
83
+ const response = await getArticleList(idName.nodeId);
84
+ const list = parseArticleList(response);
85
+ const fullTextList = await Promise.all(list.map((item) => getArticle(item)));
86
+ return {
87
+ title: `${idName.name} - 游民星空`,
88
+ link: 'https://www.gamersky.com/news',
89
+ item: fullTextList,
90
+ };
91
+ }
@@ -0,0 +1,80 @@
1
+ import type { Route } from '@/types';
2
+ import type { Context } from 'hono';
3
+ import { getArticleList, parseArticleList, getArticle, mdTableBuilder } from './utils';
4
+ const idNameMap = [
5
+ {
6
+ type: 'pc',
7
+ name: '单机',
8
+ nodeId: '20465',
9
+ },
10
+ {
11
+ type: 'tv',
12
+ name: '电视',
13
+ nodeId: '20466',
14
+ },
15
+ {
16
+ type: 'indie',
17
+ name: '独立游戏',
18
+ nodeId: '20922',
19
+ },
20
+ {
21
+ type: 'web',
22
+ name: '网游',
23
+ nodeId: '20916',
24
+ },
25
+ {
26
+ type: 'mobile',
27
+ name: '手游',
28
+ nodeId: '20917',
29
+ },
30
+ {
31
+ type: 'all',
32
+ name: '全部评测',
33
+ nodeId: '20915',
34
+ },
35
+ ];
36
+
37
+ export const route: Route = {
38
+ path: '/review/:type?',
39
+ categories: ['game'],
40
+ example: '/gamersky/review/pc',
41
+ parameters: {
42
+ type: '评测类型,可选值为 `pc`、`tv`、`indie`、`web`、`mobile`、`all`,默认为 `pc`',
43
+ },
44
+ features: {
45
+ requireConfig: false,
46
+ requirePuppeteer: false,
47
+ antiCrawler: false,
48
+ supportBT: false,
49
+ supportPodcast: false,
50
+ supportScihub: false,
51
+ },
52
+ radar: [
53
+ {
54
+ source: ['www.gamersky.com/review'],
55
+ target: '/review',
56
+ },
57
+ ],
58
+ name: '评测',
59
+ maintainers: ['yy4382'],
60
+ description: mdTableBuilder(idNameMap),
61
+ handler,
62
+ };
63
+
64
+ async function handler(ctx: Context) {
65
+ const type = ctx.req.param('type') ?? 'pc';
66
+
67
+ const idName = idNameMap.find((item) => item.type === type);
68
+ if (!idName) {
69
+ throw new Error(`Invalid type: ${type}`);
70
+ }
71
+
72
+ const response = await getArticleList(idName.nodeId);
73
+ const list = parseArticleList(response);
74
+ const fullTextList = await Promise.all(list.map((item) => getArticle(item)));
75
+ return {
76
+ title: `${idName.name} - 游民星空评测`,
77
+ link: 'https://www.gamersky.com/review',
78
+ item: fullTextList,
79
+ };
80
+ }
@@ -0,0 +1,94 @@
1
+ import type { DataItem } from '@/types';
2
+
3
+ import ofetch from '@/utils/ofetch';
4
+ import { load } from 'cheerio';
5
+ import cache from '@/utils/cache';
6
+ import { parseDate } from '@/utils/parse-date';
7
+ import timezone from '@/utils/timezone';
8
+
9
+ interface idNameMap {
10
+ type: string;
11
+ name: string;
12
+ nodeId: string;
13
+ suffix?: string;
14
+ }
15
+ interface ArticleList {
16
+ status: string;
17
+ totalPages: number;
18
+ body: string;
19
+ }
20
+
21
+ export const getArticleList = async (nodeId) => {
22
+ const response = await ofetch<ArticleList>(
23
+ `https://db2.gamersky.com/LabelJsonpAjax.aspx?${new URLSearchParams({
24
+ jsondata: JSON.stringify({
25
+ type: 'updatenodelabel',
26
+ isCache: true,
27
+ cacheTime: 60,
28
+ nodeId,
29
+ isNodeId: 'true',
30
+ page: 1,
31
+ }),
32
+ })}`,
33
+ {
34
+ parseResponse: (txt) => JSON.parse(txt.match(/\((.+)\);/)?.[1] ?? '{}'),
35
+ }
36
+ );
37
+ return response.body;
38
+ };
39
+
40
+ export const parseArticleList = (response: string) => {
41
+ const $ = load(response);
42
+ return $('li')
43
+ .toArray()
44
+ .map((item) => {
45
+ const ele = $(item);
46
+ const a = ele.find('.tt').length ? ele.find('.tt') : ele.find('a');
47
+ const title = a.text();
48
+ const link = a.attr('href');
49
+ const pubDate = timezone(parseDate(ele.find('.time').text()), 8);
50
+ const description = ele.find('.txt').text();
51
+ if (!link) {
52
+ return;
53
+ }
54
+ return {
55
+ title,
56
+ link,
57
+ pubDate,
58
+ description,
59
+ };
60
+ })
61
+ .filter((item) => item !== undefined) satisfies DataItem[];
62
+ };
63
+
64
+ export const getArticle = (item) =>
65
+ cache.tryGet(item.link, async () => {
66
+ const response = await ofetch(item.link);
67
+ const $ = load(response);
68
+ const content = $('.Mid2L_con, .MidLcon');
69
+ content.find('.appGameBuyCardIframe, .GSAppButton, .Mid2L_down').remove();
70
+ content.find('a').each((_, item) => {
71
+ if (item.attribs.href?.startsWith('https://www.gamersky.com/showimage/id_gamersky.shtml?')) {
72
+ item.attribs.href = item.attribs.href.replace('https://www.gamersky.com/showimage/id_gamersky.shtml?', '');
73
+ }
74
+ });
75
+ content.find('img').each((_, item) => {
76
+ if (item.attribs.src === 'http://image.gamersky.com/webimg13/zhuanti/common/blank.png') {
77
+ item.attribs.src = item.attribs['data-origin'];
78
+ } else if (item.attribs.src.endsWith('_S.jpg')) {
79
+ item.attribs.src = item.attribs.src.replace('_S.jpg', '.jpg');
80
+ }
81
+ });
82
+ content.find('.Slides li').each((_, item) => {
83
+ if (item.attribs.style === 'display: none;') {
84
+ item.attribs.style = 'display: list-item;';
85
+ }
86
+ });
87
+ item.description = content.html() || item.description;
88
+ return item satisfies DataItem;
89
+ }) as Promise<DataItem>;
90
+
91
+ export function mdTableBuilder(data: idNameMap[]) {
92
+ const table = '|' + data.map((item) => `${item.type}|`).join('') + '\n|' + Array(data.length).fill('---|').join('') + '\n|' + data.map((item) => `${item.name}|`).join('') + '\n';
93
+ return table;
94
+ }
@@ -1,7 +1,6 @@
1
1
  import { Route } from '@/types';
2
2
  import cache from '@/utils/cache';
3
3
  import got from '@/utils/got';
4
- import wait from '@/utils/wait';
5
4
  import { load } from 'cheerio';
6
5
  import { CookieJar } from 'tough-cookie';
7
6
  import { parseDate } from '@/utils/parse-date';
@@ -81,7 +80,7 @@ export const route: Route = {
81
80
  },
82
81
  ],
83
82
  name: 'Unknown',
84
- maintainers: ['Jim Kirisame'],
83
+ maintainers: ['jim-kirisame'],
85
84
  handler,
86
85
  url: 'oas.gdut.edu.cn/seeyon',
87
86
  };
@@ -115,18 +114,16 @@ async function handler(ctx) {
115
114
  }
116
115
 
117
116
  // 构造文章数组
118
- const articles = [];
119
- for (const item of resp.data.list) {
120
- articles.push({
121
- title: item.title,
122
- guid: item.id,
123
- link: site + '/newsData.do?method=newsView&newsId=' + item.id,
124
- pubDate: timezone(parseDate(item.publishDate1), +8),
125
- author: item.publishUserDepart,
126
- category: item.typeName,
127
- });
128
- }
117
+ const articles = resp.data.list.map((item) => ({
118
+ title: item.title,
119
+ guid: item.id,
120
+ link: site + '/newsData.do?method=newsView&newsId=' + item.id,
121
+ pubDate: timezone(parseDate(item.publishDate1), +8),
122
+ author: item.publishUserDepart,
123
+ category: item.typeName,
124
+ }));
129
125
 
126
+ const results = [];
130
127
  // 获取实际的文章内容
131
128
  for await (const data of asyncPool(2, articles, async (data) => {
132
129
  const link = data.link;
@@ -209,18 +206,16 @@ async function handler(ctx) {
209
206
  }
210
207
  });
211
208
 
212
- // 防止太快被Ban
213
- await wait(500);
214
209
  return node.html();
215
210
  });
216
211
  })) {
217
- data;
212
+ results.push(data);
218
213
  }
219
214
 
220
215
  return {
221
216
  title: `广东工业大学新闻通知网 - ` + type.name,
222
217
  link: site,
223
218
  description: `广东工业大学新闻通知网`,
224
- item: articles,
219
+ item: results,
225
220
  };
226
221
  }
@@ -0,0 +1,60 @@
1
+ import { Route } from '@/types';
2
+
3
+ import { load } from 'cheerio';
4
+ import { parseDate } from '@/utils/parse-date';
5
+ import cache from '@/utils/cache';
6
+ import ofetch from '@/utils/ofetch';
7
+
8
+ export const route: Route = {
9
+ path: '/:path{.*}',
10
+ categories: ['new-media'],
11
+ example: '/gis/c/security-challenges/',
12
+ parameters: { path: '包含"Reports"页面下的路径' },
13
+ name: '报告',
14
+ maintainers: ['dzx-dzx'],
15
+ radar: [
16
+ {
17
+ source: ['www.gisreportsonline.com'],
18
+ },
19
+ ],
20
+ handler,
21
+ };
22
+
23
+ async function handler(ctx) {
24
+ const rootUrl = 'https://www.gisreportsonline.com';
25
+ const currentUrl = `${rootUrl}/${ctx.req.param('path')}`;
26
+ const response = await ofetch(currentUrl);
27
+
28
+ const $ = load(response);
29
+
30
+ const list = $('article h3 a')
31
+ .toArray()
32
+ .map((e) => ({ link: $(e).attr('href'), title: $(e).text() }));
33
+
34
+ const items = await Promise.all(
35
+ list.map((item) =>
36
+ cache.tryGet(item.link, async () => {
37
+ const content = load(await ofetch(item.link));
38
+ const ldjson = JSON.parse(content('script.rank-math-schema-pro').text())['@graph'].find((e) => e['@type'] === 'NewsArticle');
39
+
40
+ item.pubDate = parseDate(ldjson.datePublished);
41
+ item.updated = parseDate(ldjson.dateModified);
42
+ item.author = [ldjson.author];
43
+ item.category = ldjson.keywords.split(',');
44
+ item.language = ldjson.inLanguage;
45
+
46
+ item.description = content('header.entry-header ~ :not(#pos-conclusion ~ *)')
47
+ .toArray()
48
+ .map((e) => content(e).prop('outerHTML'))
49
+ .join('');
50
+
51
+ return item;
52
+ })
53
+ )
54
+ );
55
+ return {
56
+ title: $('title').text(),
57
+ link: currentUrl,
58
+ item: items,
59
+ };
60
+ }
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'GIS Reports',
5
+ url: 'www.gisreportsonline.com',
6
+ };
@@ -2,6 +2,7 @@ import { Route, ViewType } from '@/types';
2
2
  import ofetch from '@/utils/ofetch';
3
3
  import { parseDate } from '@/utils/parse-date';
4
4
  import Parser from 'rss-parser';
5
+ import sanitizeHtml from 'sanitize-html';
5
6
 
6
7
  const parser = new Parser();
7
8
 
@@ -38,16 +39,16 @@ export const route: Route = {
38
39
  const image = raw.match(/<media:thumbnail height="30" width="30" url="(.+?)"/)?.[1];
39
40
  const feed = await parser.parseString(raw);
40
41
  return {
41
- title: `${user}'s GitHub Public Timeline Feed`,
42
+ title: `${user}'s GitHub activities`,
42
43
  link: feed.link,
43
44
  image,
44
45
  item: feed.items.map((item) => ({
45
46
  title: item.title ?? '',
46
47
  link: item.link,
47
- description: item.content?.replace(/href="(.+?)"/g, `href="https://github.com$1"`),
48
+ description: sanitizeHtml(item.content?.replace(/href="(.+?)"/g, `href="https://github.com$1"`) ?? '', { allowedTags: [...sanitizeHtml.defaults.allowedTags, 'img'] }),
48
49
  pubDate: item.pubDate ? parseDate(item.pubDate) : undefined,
49
50
  author: item.author,
50
- id: item.id,
51
+ guid: item.id,
51
52
  image,
52
53
  })),
53
54
  };