rsshub 1.0.0-master.bed0ab8 → 1.0.0-master.bf11a10

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 (276) hide show
  1. package/lib/config.ts +14 -0
  2. package/lib/errors/index.test.ts +2 -2
  3. package/lib/middleware/template.tsx +12 -3
  4. package/lib/router.js +0 -3
  5. package/lib/routes/0x80/index.ts +87 -0
  6. package/lib/routes/0x80/namespace.ts +7 -0
  7. package/lib/routes/69shu/article.ts +96 -0
  8. package/lib/routes/{thecatcity → 69shu}/namespace.ts +2 -2
  9. package/lib/routes/accessbriefing/index.ts +217 -0
  10. package/lib/routes/accessbriefing/namespace.ts +8 -0
  11. package/lib/routes/accessbriefing/templates/description.art +27 -0
  12. package/lib/routes/aljazeera/index.ts +17 -14
  13. package/lib/routes/apnews/rss.ts +41 -0
  14. package/lib/routes/apnews/topics.ts +2 -16
  15. package/lib/routes/apnews/utils.ts +20 -0
  16. package/lib/routes/apple/podcast.ts +64 -0
  17. package/lib/routes/baai/events.ts +10 -21
  18. package/lib/routes/baai/hub.ts +59 -29
  19. package/lib/routes/baai/utils.ts +19 -4
  20. package/lib/routes/bangumi/tv/other/followrank.ts +29 -16
  21. package/lib/routes/baozimh/index.ts +3 -1
  22. package/lib/routes/bbc/index.ts +22 -17
  23. package/lib/routes/bilibili/api-interface.d.ts +8 -0
  24. package/lib/routes/bilibili/cache.ts +1 -1
  25. package/lib/routes/bilibili/dynamic.ts +18 -4
  26. package/lib/routes/bing/daily-wallpaper.ts +9 -8
  27. package/lib/routes/bnu/mba.ts +202 -0
  28. package/lib/routes/byau/namespace.ts +6 -0
  29. package/lib/routes/byau/xinwen/index.ts +72 -0
  30. package/lib/routes/caixin/templates/article.art +1 -1
  31. package/lib/routes/caixin/weekly.ts +5 -14
  32. package/lib/routes/chub/characters.ts +64 -0
  33. package/lib/routes/chub/namespace.ts +6 -0
  34. package/lib/routes/cnbeta/category.ts +23 -0
  35. package/lib/routes/cnbeta/{type.ts → common.ts} +1 -17
  36. package/lib/routes/cnbeta/index.ts +16 -0
  37. package/lib/routes/cnbeta/namespace.ts +1 -0
  38. package/lib/routes/cnbeta/topics.ts +23 -0
  39. package/lib/routes/cnblogs/common.ts +0 -2
  40. package/lib/routes/cnki/author.ts +2 -2
  41. package/lib/routes/cnki/utils.ts +1 -1
  42. package/lib/routes/colamanga/manga.ts +88 -0
  43. package/lib/routes/colamanga/namespace.ts +9 -0
  44. package/lib/routes/copernicium/index.ts +67 -0
  45. package/lib/routes/copernicium/namespace.ts +6 -0
  46. package/lib/routes/cpcaauto/index.ts +255 -0
  47. package/lib/routes/cpcaauto/namespace.ts +8 -0
  48. package/lib/routes/creative-comic/book.ts +2 -2
  49. package/lib/routes/creative-comic/utils.ts +1 -1
  50. package/lib/routes/crossbell/feeds/following.ts +20 -18
  51. package/lib/routes/crossbell/notes/utils.ts +15 -17
  52. package/lib/routes/daily/discussed.ts +0 -11
  53. package/lib/routes/daily/index.ts +2 -2
  54. package/lib/routes/daily/namespace.ts +1 -0
  55. package/lib/routes/daily/templates/posts.art +7 -0
  56. package/lib/routes/daily/upvoted.ts +5 -16
  57. package/lib/routes/daily/user.ts +227 -0
  58. package/lib/routes/daily/utils.ts +33 -16
  59. package/lib/routes/darwinawards/index.ts +3 -4
  60. package/lib/routes/darwinawards/namespace.ts +1 -0
  61. package/lib/routes/deepin/homepage.ts +6 -4
  62. package/lib/routes/dehenglaw/index.ts +128 -0
  63. package/lib/routes/dehenglaw/namespace.ts +8 -0
  64. package/lib/routes/dehenglaw/templates/description.art +7 -0
  65. package/lib/routes/digitalcameraworld/namespace.ts +6 -0
  66. package/lib/routes/digitalcameraworld/news.ts +61 -0
  67. package/lib/routes/dnaindia/category.ts +0 -105
  68. package/lib/routes/dnaindia/common.ts +68 -0
  69. package/lib/routes/dnaindia/namespace.ts +1 -0
  70. package/lib/routes/dnaindia/news.ts +24 -0
  71. package/lib/routes/dnaindia/topic.ts +28 -0
  72. package/lib/routes/douyin/live.ts +1 -1
  73. package/lib/routes/douyin/templates/embed.art +1 -1
  74. package/lib/routes/douyu/room.ts +58 -18
  75. package/lib/routes/ecnu/jwc.ts +67 -0
  76. package/lib/routes/ecnu/namespace.ts +1 -1
  77. package/lib/routes/economist/espresso.ts +1 -1
  78. package/lib/routes/fanbox/index.ts +62 -0
  79. package/lib/routes/fanbox/namespace.ts +6 -0
  80. package/lib/routes/fanbox/templates/fanbox-post.art +7 -0
  81. package/lib/routes/fanbox/types.ts +239 -0
  82. package/lib/routes/fanbox/utils.ts +188 -0
  83. package/lib/routes/fansly/templates/media.art +1 -1
  84. package/lib/routes/farmatters/index.ts +0 -1
  85. package/lib/routes/farmatters/namespace.ts +1 -0
  86. package/lib/routes/freexcomic/book.ts +84 -0
  87. package/lib/routes/freexcomic/namespace.ts +7 -0
  88. package/lib/routes/github/pulls.ts +5 -5
  89. package/lib/routes/gov/ah/kjt.ts +229 -0
  90. package/lib/routes/gov/ah/namespace.ts +8 -0
  91. package/lib/routes/gov/jiangsu/wlt/index.ts +99 -0
  92. package/lib/routes/gov/jiangsu/wlt/templates/wlt.art +9 -0
  93. package/lib/routes/gov/{namespace.ts → pbc/namespace.ts} +1 -1
  94. package/lib/routes/gov/stats/index.ts +25 -22
  95. package/lib/routes/gov/zj/search.ts +80 -0
  96. package/lib/routes/gq/namespace.ts +6 -0
  97. package/lib/routes/gq/news.ts +59 -0
  98. package/lib/routes/gxmzu/ai.ts +1 -1
  99. package/lib/routes/gxmzu/lib.ts +9 -26
  100. package/lib/routes/gxmzu/utils/index.ts +31 -13
  101. package/lib/routes/gxmzu/yjs.ts +1 -1
  102. package/lib/routes/hackernews/index.ts +1 -1
  103. package/lib/routes/hellogithub/index.ts +2 -2
  104. package/lib/routes/hellogithub/report.ts +2 -1
  105. package/lib/routes/hellogithub/volume.ts +39 -24
  106. package/lib/routes/houxu/events.ts +0 -9
  107. package/lib/routes/houxu/index.ts +4 -6
  108. package/lib/routes/houxu/memory.ts +0 -9
  109. package/lib/routes/hoyolab/news.ts +5 -5
  110. package/lib/routes/ieee-security/sp.ts +6 -15
  111. package/lib/routes/iehou/index.ts +125 -0
  112. package/lib/routes/iehou/namespace.ts +8 -0
  113. package/lib/routes/ifeng/templates/video.art +1 -1
  114. package/lib/routes/instagram/templates/video.art +1 -1
  115. package/lib/routes/itc/collection.ts +66 -0
  116. package/lib/routes/itc/namespace.ts +6 -0
  117. package/lib/routes/ithome/templates/description.art +13 -0
  118. package/lib/routes/ithome/zt.ts +118 -56
  119. package/lib/routes/javdb/index.ts +0 -1
  120. package/lib/routes/jou/utils/index.ts +35 -25
  121. package/lib/routes/kcna/utils.ts +1 -1
  122. package/lib/routes/keylol/index.ts +88 -12
  123. package/lib/routes/kpmg/insights.ts +143 -0
  124. package/lib/routes/kpmg/namespace.ts +10 -0
  125. package/lib/routes/kpmg/templates/description.art +11 -0
  126. package/lib/routes/lianxh/index.ts +116 -0
  127. package/lib/routes/lianxh/namespace.ts +7 -0
  128. package/lib/routes/linkedin/jobs.ts +69 -11
  129. package/lib/routes/linkedin/namespace.ts +1 -1
  130. package/lib/routes/linkedin/utils.ts +21 -6
  131. package/lib/routes/lofter/tag.ts +3 -3
  132. package/lib/routes/lofter/user.ts +3 -3
  133. package/lib/routes/logonews/index.ts +0 -2
  134. package/lib/routes/lrepacks/index.ts +201 -0
  135. package/lib/routes/lrepacks/namespace.ts +8 -0
  136. package/lib/routes/lrepacks/templates/description.art +21 -0
  137. package/lib/routes/magnumphotos/magazine.ts +63 -0
  138. package/lib/routes/magnumphotos/namespace.ts +6 -0
  139. package/lib/routes/mckinsey/cn/index.ts +4 -7
  140. package/lib/routes/mihoyo/bbs/official.ts +86 -17
  141. package/lib/routes/mihoyo/templates/official.art +7 -0
  142. package/lib/routes/mingpao/templates/fancybox.art +1 -1
  143. package/lib/routes/missav/templates/preview.art +1 -1
  144. package/lib/routes/mixcloud/index.ts +26 -6
  145. package/lib/routes/mixcloud/queries.ts +934 -186
  146. package/lib/routes/nber/all.ts +19 -0
  147. package/lib/routes/nber/{index.ts → common.ts} +5 -34
  148. package/lib/routes/nber/namespace.ts +1 -0
  149. package/lib/routes/nber/new.ts +20 -0
  150. package/lib/routes/ncc-cma/cmdp.ts +289 -32
  151. package/lib/routes/ncc-cma/namespace.ts +2 -0
  152. package/lib/routes/ncu/jwc.ts +13 -2
  153. package/lib/routes/newyorker/namespace.ts +6 -0
  154. package/lib/routes/newyorker/news.ts +62 -0
  155. package/lib/routes/nju/jw.ts +4 -2
  156. package/lib/routes/njuferret/blog.ts +41 -0
  157. package/lib/routes/njuferret/namespace.ts +10 -0
  158. package/lib/routes/njxzc/utils/index.ts +31 -13
  159. package/lib/routes/olevod/namespace.ts +6 -0
  160. package/lib/routes/olevod/vod.ts +49 -0
  161. package/lib/routes/olevod/vodlist.ts +48 -0
  162. package/lib/routes/ollama/models.ts +39 -0
  163. package/lib/routes/ollama/namespace.ts +6 -0
  164. package/lib/routes/p-articles/contributors.ts +53 -0
  165. package/lib/routes/p-articles/namespace.ts +13 -0
  166. package/lib/routes/p-articles/section.ts +60 -0
  167. package/lib/routes/p-articles/utils.ts +21 -0
  168. package/lib/routes/panewslab/news.ts +1 -11
  169. package/lib/routes/panewslab/{index.ts → profundity.ts} +3 -11
  170. package/lib/routes/papers/index.ts +100 -59
  171. package/lib/routes/papers/namespace.ts +2 -0
  172. package/lib/routes/pikabu/templates/video.art +1 -1
  173. package/lib/routes/pornhub/templates/description.art +1 -1
  174. package/lib/routes/qingting/podcast.ts +61 -39
  175. package/lib/routes/reuters/common.ts +2 -2
  176. package/lib/routes/sara/index.ts +66 -0
  177. package/lib/routes/sara/namespace.ts +6 -0
  178. package/lib/routes/sigsac/ccs.ts +16 -22
  179. package/lib/routes/sina/templates/video.art +1 -1
  180. package/lib/routes/sjtu/yzb/zkxx.ts +2 -2
  181. package/lib/routes/sohu/mp.ts +183 -63
  182. package/lib/routes/stbu/jsjxy.ts +3 -3
  183. package/lib/routes/stbu/xyxw.ts +14 -3
  184. package/lib/routes/steam/appcommunityfeed.ts +92 -0
  185. package/lib/routes/steam/templates/appcommunityfeed-description.art +4 -0
  186. package/lib/routes/taptap/review.ts +23 -23
  187. package/lib/routes/techcrunch/news.ts +2 -0
  188. package/lib/routes/techflowpost/express.ts +1 -11
  189. package/lib/routes/techflowpost/index.ts +2 -2
  190. package/lib/routes/telegram/channel.ts +12 -0
  191. package/lib/routes/tencent/news/author.ts +13 -11
  192. package/lib/routes/test/index.ts +11 -1
  193. package/lib/routes/tfc-taiwan/common.ts +38 -0
  194. package/lib/routes/tfc-taiwan/index.ts +10 -40
  195. package/lib/routes/tfc-taiwan/topic.ts +17 -0
  196. package/lib/routes/theinitium/author.ts +23 -0
  197. package/lib/routes/theinitium/channel.ts +28 -0
  198. package/lib/routes/theinitium/follow.ts +48 -0
  199. package/lib/routes/theinitium/tags.ts +23 -0
  200. package/lib/routes/theinitium/{full.ts → utils.ts} +19 -14
  201. package/lib/routes/{thecatcity → thepetcity}/index.ts +23 -32
  202. package/lib/routes/thepetcity/namespace.ts +6 -0
  203. package/lib/routes/thepetcity/terms-map.ts +28 -0
  204. package/lib/routes/threads/index.ts +36 -38
  205. package/lib/routes/threads/utils.ts +43 -12
  206. package/lib/routes/tiktok/templates/user.art +1 -1
  207. package/lib/routes/trendingpapers/papers.ts +3 -9
  208. package/lib/routes/ttv/index.ts +78 -0
  209. package/lib/routes/ttv/namespace.ts +6 -0
  210. package/lib/routes/twitter/api/mobile-api/login.ts +36 -33
  211. package/lib/routes/twitter/api/web-api/api.ts +13 -1
  212. package/lib/routes/twitter/api/web-api/constants.ts +31 -0
  213. package/lib/routes/twitter/api/web-api/utils.ts +6 -2
  214. package/lib/routes/twitter/likes.ts +15 -11
  215. package/lib/routes/twitter/namespace.ts +2 -2
  216. package/lib/routes/twitter/tweet.ts +10 -1
  217. package/lib/routes/twitter/user.ts +5 -0
  218. package/lib/routes/u3c3/index.ts +1 -1
  219. package/lib/routes/u3c3/namespace.ts +1 -1
  220. package/lib/routes/u9a9/index.ts +2 -2
  221. package/lib/routes/u9a9/namespace.ts +1 -1
  222. package/lib/routes/upc/jwc.ts +121 -0
  223. package/lib/routes/usenix/usenix.ts +24 -31
  224. package/lib/routes/wechat/tgchannel.ts +8 -1
  225. package/lib/routes/weekendhk/posts.ts +2 -2
  226. package/lib/routes/weibo/keyword.ts +12 -10
  227. package/lib/routes/wellcee/namespace.ts +7 -0
  228. package/lib/routes/wellcee/rent.ts +81 -0
  229. package/lib/routes/wellcee/support-city.ts +46 -0
  230. package/lib/routes/wellcee/templates/house.art +18 -0
  231. package/lib/routes/wellcee/types.ts +58 -0
  232. package/lib/routes/wellcee/utils.ts +45 -0
  233. package/lib/routes/wnacg/category.ts +17 -0
  234. package/lib/routes/wnacg/common.ts +111 -0
  235. package/lib/routes/wnacg/index.ts +7 -117
  236. package/lib/routes/wnacg/tag.ts +17 -0
  237. package/lib/routes/xueqiu/cookies.ts +15 -0
  238. package/lib/routes/xueqiu/favorite.ts +2 -7
  239. package/lib/routes/xueqiu/hots.ts +2 -6
  240. package/lib/routes/xueqiu/stock-info.ts +2 -1
  241. package/lib/routes/xueqiu/today.ts +2 -7
  242. package/lib/routes/xueqiu/user-stock.ts +14 -17
  243. package/lib/routes/xueqiu/user.ts +2 -7
  244. package/lib/routes/yenpress/namespace.ts +7 -0
  245. package/lib/routes/yenpress/series.ts +115 -0
  246. package/lib/routes/yenpress/templates/series.art +25 -0
  247. package/lib/routes/zhihu/activities.ts +5 -4
  248. package/lib/routes/zhihu/topic.ts +1 -1
  249. package/lib/routes/zsxq/group.ts +63 -0
  250. package/lib/routes/zsxq/namespace.ts +6 -0
  251. package/lib/routes/zsxq/types.ts +149 -0
  252. package/lib/routes/zsxq/user.ts +58 -0
  253. package/lib/routes/zsxq/utils.ts +70 -0
  254. package/lib/setup.test.ts +184 -12
  255. package/lib/utils/got.test.ts +2 -1
  256. package/lib/utils/got.ts +2 -5
  257. package/lib/utils/render.ts +1 -1
  258. package/lib/utils/request-rewriter/get.ts +8 -1
  259. package/lib/utils/wechat-mp.test.ts +411 -32
  260. package/lib/utils/wechat-mp.ts +447 -76
  261. package/lib/views/error.tsx +1 -23
  262. package/lib/views/index.tsx +4 -26
  263. package/lib/views/layout.tsx +50 -0
  264. package/lib/views/{rss3-ums.ts → rss3.ts} +2 -2
  265. package/package.json +52 -49
  266. package/lib/routes/baai/comments.ts +0 -59
  267. package/lib/routes/gov/anhui/kjt.ts +0 -65
  268. package/lib/routes/thecatcity/terms-map.ts +0 -28
  269. package/lib/routes-deprecated/fanbox/conv.js +0 -227
  270. package/lib/routes-deprecated/fanbox/header.js +0 -13
  271. package/lib/routes-deprecated/fanbox/main.js +0 -45
  272. package/lib/routes-deprecated/kpmg/insights.js +0 -79
  273. package/lib/routes-deprecated/manxiaosi/book.js +0 -49
  274. package/lib/routes-deprecated/p-articles/contributors.js +0 -45
  275. package/lib/routes-deprecated/p-articles/section.js +0 -53
  276. package/lib/routes-deprecated/p-articles/utils.js +0 -30
package/lib/config.ts CHANGED
@@ -230,6 +230,9 @@ export type Config = {
230
230
  pkubbs: {
231
231
  cookie?: string;
232
232
  };
233
+ qingting: {
234
+ id?: string;
235
+ };
233
236
  saraba1st: {
234
237
  cookie?: string;
235
238
  };
@@ -258,6 +261,7 @@ export type Config = {
258
261
  oauthTokenSecrets?: string[];
259
262
  username?: string;
260
263
  password?: string;
264
+ authenticationSecret?: string;
261
265
  cookie?: string;
262
266
  };
263
267
  weibo: {
@@ -294,6 +298,9 @@ export type Config = {
294
298
  zodgame: {
295
299
  cookie?: string;
296
300
  };
301
+ zsxq: {
302
+ accessToken?: string;
303
+ };
297
304
  };
298
305
 
299
306
  const value: Config | Record<string, any> = {};
@@ -575,6 +582,9 @@ const calculateValue = () => {
575
582
  pkubbs: {
576
583
  cookie: envs.PKUBBS_COOKIE,
577
584
  },
585
+ qingting: {
586
+ id: envs.QINGTING_ID,
587
+ },
578
588
  saraba1st: {
579
589
  cookie: envs.SARABA1ST_COOKIE,
580
590
  },
@@ -607,6 +617,7 @@ const calculateValue = () => {
607
617
  oauthTokenSecrets: envs.TWITTER_OAUTH_TOKEN_SECRET?.split(','),
608
618
  username: envs.TWITTER_USERNAME,
609
619
  password: envs.TWITTER_PASSWORD,
620
+ authenticationSecret: envs.TWITTER_AUTHENTICATION_SECRET,
610
621
  cookie: envs.TWITTER_COOKIE,
611
622
  },
612
623
  weibo: {
@@ -643,6 +654,9 @@ const calculateValue = () => {
643
654
  zodgame: {
644
655
  cookie: envs.ZODGAME_COOKIE,
645
656
  },
657
+ zsxq: {
658
+ accessToken: envs.ZSXQ_ACCESS_TOKEN,
659
+ },
646
660
  };
647
661
 
648
662
  for (const name in _value) {
@@ -66,13 +66,13 @@ describe('route throws an error', () => {
66
66
  expect(value).toBe('9');
67
67
  break;
68
68
  case 'Hot Routes:':
69
- expect(value).toBe('6 /test/:id<br>');
69
+ expect(value).toBe('6 /test/:id/:params?<br>');
70
70
  break;
71
71
  case 'Hot Paths:':
72
72
  expect(value).toBe('2 /test/error<br>2 /test/slow<br>1 /test/httperror<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>1 /<br>');
73
73
  break;
74
74
  case 'Hot Error Routes:':
75
- expect(value).toBe('5 /test/:id<br>');
75
+ expect(value).toBe('5 /test/:id/:params?<br>');
76
76
  break;
77
77
  case 'Hot Error Paths:':
78
78
  expect(value).toBe('2 /test/error<br>1 /test/httperror<br>1 /test/slow<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>');
@@ -1,4 +1,4 @@
1
- import { rss3Ums, json, RSS, Atom } from '@/utils/render';
1
+ import { rss3, json, RSS, Atom } from '@/utils/render';
2
2
  import { config } from '@/config';
3
3
  import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
4
4
  import type { MiddlewareHandler } from 'hono';
@@ -48,6 +48,14 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
48
48
  }
49
49
  }
50
50
 
51
+ if (item.description) {
52
+ // https://stackoverflow.com/questions/2507608/error-input-is-not-proper-utf-8-indicate-encoding-using-phps-simplexml-lo/40552083#40552083
53
+ // https://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string/1497928#1497928
54
+ // remove unicode control characters
55
+ // see #14940 #14943 #15262
56
+ item.description = item.description.replaceAll(/[\u0000-\u0009\u000B\u000C\u000E-\u001F\u007F]/g, '');
57
+ }
58
+
51
59
  if (typeof item.author === 'string') {
52
60
  item.author = collapseWhitespace(item.author) || '';
53
61
  } else if (typeof item.author === 'object' && item.author !== null) {
@@ -86,8 +94,9 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
86
94
  return ctx.json(result);
87
95
  }
88
96
 
89
- if (outputType === 'ums') {
90
- return ctx.json(rss3Ums(result));
97
+ // retain .ums for backward compatibility
98
+ if (outputType === 'ums' || outputType === 'rss3') {
99
+ return ctx.json(rss3(result));
91
100
  } else if (outputType === 'json') {
92
101
  ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
93
102
  return ctx.body(json(result));
package/lib/router.js CHANGED
@@ -25,9 +25,6 @@ router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent
25
25
  // router.get('/jianshu/collection/:id', lazyloadRouteHandler('./routes/jianshu/collection'));
26
26
  // router.get('/jianshu/user/:id', lazyloadRouteHandler('./routes/jianshu/user'));
27
27
 
28
- // pixiv-fanbox
29
- router.get('/fanbox/:user?', lazyloadRouteHandler('./routes/fanbox/main'));
30
-
31
28
  // Disqus
32
29
  router.get('/disqus/posts/:forum', lazyloadRouteHandler('./routes/disqus/posts'));
33
30
 
@@ -0,0 +1,87 @@
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 route: Route = {
9
+ path: '/blog',
10
+ categories: ['blog'],
11
+ example: '/0x80/blog',
12
+ url: '0x80.pl/notesen.html',
13
+ name: 'Articles',
14
+ maintainers: ['xnum'],
15
+ handler,
16
+ };
17
+
18
+ function extractDateFromURL(url: string) {
19
+ const regex = /\d{4}-\d{2}-\d{2}/;
20
+ const match = url.match(regex);
21
+
22
+ return match ? match[0] : null;
23
+ }
24
+
25
+ async function handler() {
26
+ // The TLS cert is invalid, we are limited to use HTTP unfortunately.
27
+ const baseUrl = 'http://0x80.pl/';
28
+ const targetUrl = `${baseUrl}notesen.html`;
29
+
30
+ const response = await got({
31
+ method: 'get',
32
+ url: targetUrl,
33
+ });
34
+
35
+ const $ = load(response.data);
36
+
37
+ const alist = $('a.reference.external');
38
+
39
+ const list = alist
40
+ .toArray()
41
+ .map((item) => {
42
+ item = $(item);
43
+
44
+ const link = item.attr('href') || '';
45
+ const title = item.text() || '';
46
+ const pubDate = extractDateFromURL(link);
47
+
48
+ return {
49
+ title,
50
+ link,
51
+ pubDate,
52
+ category: 'Uncategoried',
53
+ };
54
+ })
55
+ .filter((item) => item.link.startsWith('notesen'));
56
+
57
+ const items = await Promise.all(
58
+ list.map((item) =>
59
+ cache.tryGet(item.link, async () => {
60
+ const articleUrl = `${baseUrl}${item.link}`;
61
+ const response = await got({
62
+ method: 'get',
63
+ url: articleUrl,
64
+ });
65
+
66
+ const $ = load(response.data);
67
+
68
+ const author = $('tr.author.field td.field-body').text();
69
+ const articlePubDate = $('tr.added-on.field td.field-body').text();
70
+
71
+ item.author = author;
72
+ // Some articles might be missing the added-on field.
73
+ // As a safeguard, if the date from url is null, fallbacks to the article one.
74
+ item.pubDate = parseDate(item.pubDate || articlePubDate);
75
+ item.description = $('div.document').first().html();
76
+
77
+ return item;
78
+ })
79
+ )
80
+ );
81
+
82
+ return {
83
+ title: '0x80.pl articles',
84
+ link: targetUrl,
85
+ item: items,
86
+ };
87
+ }
@@ -0,0 +1,7 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Wojciech Muła',
5
+ url: '0x80.pl',
6
+ description: '',
7
+ };
@@ -0,0 +1,96 @@
1
+ import { load } from 'cheerio';
2
+ import cache from '@/utils/cache';
3
+ import ofetch from '@/utils/ofetch';
4
+ import type { Route, DataItem } from '@/types';
5
+
6
+ export const route: Route = {
7
+ path: '/article/:id',
8
+ name: '章节',
9
+ url: 'www.69shu.top',
10
+ maintainers: ['eternasuno'],
11
+ example: '/article/47117',
12
+ parameters: { id: '小说 id, 可在对应小说页 URL 中找到' },
13
+ categories: ['reading'],
14
+ features: {
15
+ requireConfig: false,
16
+ requirePuppeteer: false,
17
+ antiCrawler: false,
18
+ supportBT: false,
19
+ supportPodcast: false,
20
+ supportScihub: false,
21
+ },
22
+ radar: [
23
+ {
24
+ source: ['www.69shu.top/book/:id.htm'],
25
+ target: '/article/:id',
26
+ },
27
+ ],
28
+ handler: async (ctx) => {
29
+ const { id } = ctx.req.param();
30
+ const link = `https://www.69shu.top/book/${id}.htm`;
31
+ const $ = load(await get(link));
32
+
33
+ const item = await Promise.all(
34
+ $('.qustime li>a')
35
+ .map((_, chapter) => createItem(chapter.attribs.href))
36
+ .toArray()
37
+ );
38
+
39
+ return {
40
+ title: $('h1>a').text(),
41
+ description: $('.navtxt>p:first-of-type').text(),
42
+ link,
43
+ item,
44
+ image: $('.bookimg2>img').attr('src'),
45
+ author: $('.booknav2>p:first-of-type>a').text(),
46
+ language: 'zh-cn',
47
+ };
48
+ },
49
+ };
50
+
51
+ const createItem = (url: string) =>
52
+ cache.tryGet(url, async () => {
53
+ const $ = load(await get(url));
54
+ const { articleid, chapterid, chaptername } = parseObject(/bookinfo\s?=\s?{[\S\s]+?}/, $('head>script:not([src])').text());
55
+ const decryptionMap = parseObject(/_\d+\s?=\s?{[\S\s]+?}/, $('.txtnav+script').text());
56
+
57
+ return {
58
+ title: chaptername,
59
+ description: decrypt($('.txtnav').html() || '', articleid, chapterid, decryptionMap),
60
+ link: url,
61
+ };
62
+ }) as Promise<DataItem>;
63
+
64
+ const get = async (url: string, encoding = 'gbk') => new TextDecoder(encoding).decode(await ofetch(url, { responseType: 'arrayBuffer' }));
65
+
66
+ const parseObject = (reg: RegExp, str: string): Record<string, string> => {
67
+ const obj = {};
68
+ const match = reg.exec(str);
69
+ if (match) {
70
+ for (const line of match[0].matchAll(/(\w+):\s?["']?([\S\s]+?)["']?[\n,}]/g)) {
71
+ obj[line[1]] = line[2];
72
+ }
73
+ }
74
+
75
+ return obj;
76
+ };
77
+
78
+ const decrypt = (txt: string, articleid: string, chapterid: string, decryptionMap: Record<string, string>) => {
79
+ if (!txt || txt.length < 10) {
80
+ return txt;
81
+ }
82
+
83
+ const lineMap = {};
84
+ const articleKey = Number(articleid) + 3_061_711;
85
+ const chapterKey = Number(chapterid) + 3_421_001;
86
+ for (const key of Object.keys(decryptionMap)) {
87
+ lineMap[(Number(key) ^ chapterKey) - articleKey] = (Number(decryptionMap[key]) ^ chapterKey) - articleKey;
88
+ }
89
+
90
+ return txt
91
+ .split('<br><br>')
92
+ .map((line, index, array) => (lineMap[index] ? array[lineMap[index]] : line))
93
+ .slice(1, -1)
94
+ .join('<br>')
95
+ .replaceAll(/\u2003|(<div[\S\s]*?<\/div>)/g, '');
96
+ };
@@ -1,6 +1,6 @@
1
1
  import type { Namespace } from '@/types';
2
2
 
3
3
  export const namespace: Namespace = {
4
- name: '貓奴日常',
5
- url: 'thecatcity.com',
4
+ name: '69书吧',
5
+ url: '69shu.top',
6
6
  };
@@ -0,0 +1,217 @@
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 { parseDate } from '@/utils/parse-date';
9
+ import { art } from '@/utils/render';
10
+ import path from 'node:path';
11
+
12
+ export const handler = async (ctx) => {
13
+ const { category = 'latest/news' } = ctx.req.param();
14
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
15
+
16
+ const rootUrl = 'https://www.accessbriefing.com';
17
+ const currentUrl = new URL(category, rootUrl).href;
18
+ const apiUrl = new URL('Ajax/GetPagedArticles', rootUrl).href;
19
+
20
+ const { data: currentResponse } = await got(currentUrl);
21
+
22
+ const brandId = currentResponse.match(/'BrandID':\s(\d+)/)?.[1] ?? '32';
23
+ const moreID = currentResponse.match(/'MoreID':\s(\d+)/)?.[1] ?? '9282';
24
+
25
+ const { data: response } = await got(apiUrl, {
26
+ searchParams: {
27
+ navcontentid: moreID,
28
+ brandid: brandId,
29
+ page: 0,
30
+ lastpage: 0,
31
+ pagesize: limit,
32
+ },
33
+ });
34
+
35
+ const $ = load(currentResponse);
36
+
37
+ const language = $('html').prop('lang');
38
+
39
+ let items = response.slice(0, limit).map((item) => {
40
+ const title = item.Article_Headline;
41
+ const image = new URL(item.Image, rootUrl).href;
42
+ const description = art(path.join(__dirname, 'templates/description.art'), {
43
+ images: image
44
+ ? [
45
+ {
46
+ src: image,
47
+ alt: title,
48
+ },
49
+ ]
50
+ : undefined,
51
+ intro: item.Article_Intro_Plaintext,
52
+ });
53
+ const guid = `accessbriefing-${item.Article_ID}`;
54
+
55
+ return {
56
+ title,
57
+ description,
58
+ pubDate: parseDate(item.Article_PublishedDate),
59
+ link: new URL(item.URL, rootUrl).href,
60
+ author: item.Authors.join('/'),
61
+ guid,
62
+ id: guid,
63
+ content: {
64
+ html: description,
65
+ text: item.Article_Intro_Plaintext,
66
+ },
67
+ image,
68
+ banner: image,
69
+ language,
70
+ };
71
+ });
72
+
73
+ items = await Promise.all(
74
+ items.map((item) =>
75
+ cache.tryGet(item.link, async () => {
76
+ const { data: detailResponse } = await got(item.link);
77
+
78
+ const $$ = load(detailResponse);
79
+
80
+ const title = $$('h1.khl-article-page-title').text();
81
+ const description =
82
+ item.description +
83
+ art(path.join(__dirname, 'templates/description.art'), {
84
+ description: $$('div.khl-article-page-storybody').html(),
85
+ });
86
+
87
+ item.title = title;
88
+ item.description = description;
89
+ item.category = $$('a.badge[data-id]')
90
+ .toArray()
91
+ .map((c) => $$(c).text());
92
+ item.author = $$('div.authorDetails a span b').text();
93
+ item.content = {
94
+ html: description,
95
+ text: $$('div.khl-article-page-storybody').text(),
96
+ };
97
+ item.language = language;
98
+
99
+ return item;
100
+ })
101
+ )
102
+ );
103
+
104
+ const image = new URL($('a.navbar-brand img').prop('src'), rootUrl).href;
105
+
106
+ return {
107
+ title: $('title').text(),
108
+ description: $('meta[property="og:description"]').prop('content'),
109
+ link: currentUrl,
110
+ item: items,
111
+ allowEmpty: true,
112
+ image,
113
+ author: $('meta[property="og:site_name"]').prop('content'),
114
+ language,
115
+ };
116
+ };
117
+
118
+ export const route: Route = {
119
+ path: '/:category{.+}?',
120
+ name: 'Articles',
121
+ url: 'accessbriefing.com',
122
+ maintainers: ['nczitzk'],
123
+ handler,
124
+ example: '/accessbriefing/latest/news',
125
+ parameters: { category: 'Category, Latest News by default' },
126
+ description: `:::tip
127
+ If you subscribe to [Latest News](https://www.accessbriefing.com/latest/news),where the URL is \`https://www.accessbriefing.com/latest/news\`, extract the part \`https://www.accessbriefing.com/\` to the end, and use it as the parameter to fill in. Therefore, the route will be [\`/accessbriefing/latest/news\`](https://rsshub.app/accessbriefing/latest/news).
128
+ :::
129
+
130
+ #### Latest
131
+
132
+ | Category | ID |
133
+ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
134
+ | [News](https://www.accessbriefing.com/latest/news) | [latest/news](https://rsshub.app/target/site/latest/news) |
135
+ | [Products & Technology](https://www.accessbriefing.com/latest/products-and-technology) | [latest/products-and-technology](https://rsshub.app/target/site/latest/products-and-technology) |
136
+ | [Rental News](https://www.accessbriefing.com/latest/rental-news) | [latest/rental-news](https://rsshub.app/target/site/latest/rental-news) |
137
+ | [People](https://www.accessbriefing.com/latest/people) | [latest/people](https://rsshub.app/target/site/latest/people) |
138
+ | [Regualtions & Safety](https://www.accessbriefing.com/latest/regualtions-safety) | [latest/regualtions-safety](https://rsshub.app/target/site/latest/regualtions-safety) |
139
+ | [Finance](https://www.accessbriefing.com/latest/finance) | [latest/finance](https://rsshub.app/target/site/latest/finance) |
140
+ | [Sustainability](https://www.accessbriefing.com/latest/sustainability) | [latest/sustainability](https://rsshub.app/target/site/latest/sustainability) |
141
+
142
+ #### Insight
143
+
144
+ | Category | ID |
145
+ | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
146
+ | [Interviews](https://www.accessbriefing.com/insight/interviews) | [insight/interviews](https://rsshub.app/target/site/insight/interviews) |
147
+ | [Longer reads](https://www.accessbriefing.com/insight/longer-reads) | [insight/longer-reads](https://rsshub.app/target/site/insight/longer-reads) |
148
+ | [Videos and podcasts](https://www.accessbriefing.com/insight/videos-and-podcasts) | [insight/videos-and-podcasts](https://rsshub.app/target/site/insight/videos-and-podcasts) |
149
+ `,
150
+ categories: ['new-media'],
151
+
152
+ features: {
153
+ requireConfig: false,
154
+ requirePuppeteer: false,
155
+ antiCrawler: false,
156
+ supportRadar: true,
157
+ supportBT: false,
158
+ supportPodcast: false,
159
+ supportScihub: false,
160
+ },
161
+ radar: [
162
+ {
163
+ source: ['accessbriefing.com/:category*'],
164
+ target: '/:category',
165
+ },
166
+ {
167
+ title: 'Latest - News',
168
+ source: ['accessbriefing.com/latest/news'],
169
+ target: '/latest/news',
170
+ },
171
+ {
172
+ title: 'Latest - Products & Technology',
173
+ source: ['accessbriefing.com/latest/products-and-technology'],
174
+ target: '/latest/products-and-technology',
175
+ },
176
+ {
177
+ title: 'Latest - Rental News',
178
+ source: ['accessbriefing.com/latest/rental-news'],
179
+ target: '/latest/rental-news',
180
+ },
181
+ {
182
+ title: 'Latest - People',
183
+ source: ['accessbriefing.com/latest/people'],
184
+ target: '/latest/people',
185
+ },
186
+ {
187
+ title: 'Latest - Regualtions & Safety',
188
+ source: ['accessbriefing.com/latest/regualtions-safety'],
189
+ target: '/latest/regualtions-safety',
190
+ },
191
+ {
192
+ title: 'Latest - Finance',
193
+ source: ['accessbriefing.com/latest/finance'],
194
+ target: '/latest/finance',
195
+ },
196
+ {
197
+ title: 'Latest - Sustainability',
198
+ source: ['accessbriefing.com/latest/sustainability'],
199
+ target: '/latest/sustainability',
200
+ },
201
+ {
202
+ title: 'Insight - Interviews',
203
+ source: ['accessbriefing.com/insight/interviews'],
204
+ target: '/insight/interviews',
205
+ },
206
+ {
207
+ title: 'Insight - Longer reads',
208
+ source: ['accessbriefing.com/insight/longer-reads'],
209
+ target: '/insight/longer-reads',
210
+ },
211
+ {
212
+ title: 'Insight - Videos and podcasts',
213
+ source: ['accessbriefing.com/insight/videos-and-podcasts'],
214
+ target: '/insight/videos-and-podcasts',
215
+ },
216
+ ],
217
+ };
@@ -0,0 +1,8 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Access Briefing',
5
+ url: 'accessbriefing.com',
6
+ categories: ['new-media'],
7
+ description: '',
8
+ };
@@ -0,0 +1,27 @@
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
+ {{ if image.width }}
10
+ alt="{{ image.width }}"
11
+ {{ /if }}
12
+ {{ if image.height }}
13
+ alt="{{ image.height }}"
14
+ {{ /if }}
15
+ src="{{ image.src }}">
16
+ </figure>
17
+ {{ /if }}
18
+ {{ /each }}
19
+ {{ /if }}
20
+
21
+ {{ if intro }}
22
+ <blockquote>{{ intro }}</blockquote>
23
+ {{ /if }}
24
+
25
+ {{ if description }}
26
+ {{@ description }}
27
+ {{ /if }}
@@ -4,11 +4,10 @@ const __dirname = getCurrentPath(import.meta.url);
4
4
 
5
5
  import { getSubPath } from '@/utils/common-utils';
6
6
  import cache from '@/utils/cache';
7
- import got from '@/utils/got';
8
7
  import { load } from 'cheerio';
9
- import { parseDate } from '@/utils/parse-date';
10
8
  import { art } from '@/utils/render';
11
9
  import path from 'node:path';
10
+ import { ofetch } from 'ofetch';
12
11
 
13
12
  const languages = {
14
13
  arabic: {
@@ -45,12 +44,8 @@ async function handler(ctx) {
45
44
  const rootUrl = languages[language].rootUrl;
46
45
  const currentUrl = `${rootUrl}/${isRSS ? languages[language].rssUrl : params.join('/')}`;
47
46
 
48
- const response = await got({
49
- method: 'get',
50
- url: currentUrl,
51
- });
52
-
53
- const $ = load(response.data);
47
+ const response = await ofetch(currentUrl);
48
+ const $ = load(response);
54
49
 
55
50
  let items = isRSS
56
51
  ? response.data.match(new RegExp('<link>' + rootUrl + '/(.*?)</link>', 'g')).map((item) => ({
@@ -69,19 +64,27 @@ async function handler(ctx) {
69
64
  items = await Promise.all(
70
65
  items.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50).map((item) =>
71
66
  cache.tryGet(item.link, async () => {
72
- const detailResponse = await got({
73
- method: 'get',
74
- url: item.link,
75
- });
67
+ const detailResponse = await ofetch(item.link);
76
68
 
77
- const content = load(detailResponse.data);
69
+ const content = load(detailResponse);
78
70
 
79
71
  content('.more-on').parent().remove();
80
72
  content('.responsive-image img').removeAttr('srcset');
73
+ let pubDate;
74
+
75
+ const datePublished = detailResponse.match(/"datePublished": ?"(.*?)",/);
76
+ if (datePublished && datePublished.length > 1) {
77
+ pubDate = detailResponse.match(/"datePublished": ?"(.*?)",/)[1];
78
+ } else {
79
+ // uploadDate replaces datePublished for video articles
80
+ const uploadDate = detailResponse.match(/"uploadDate": ?"(.*?)",/)[1];
81
+
82
+ pubDate = uploadDate && uploadDate.length > 1 ? uploadDate : content('div.date-simple > span:nth-child(2)').text();
83
+ }
81
84
 
82
85
  item.title = content('h1').first().text();
83
86
  item.author = content('.author').text();
84
- item.pubDate = parseDate(detailResponse.data.match(/"datePublished": ?"(.*?)",/)[1]);
87
+ item.pubDate = pubDate;
85
88
  item.description = art(path.join(__dirname, 'templates/description.art'), {
86
89
  image: content('.article-featured-image').html(),
87
90
  description: content('.wysiwyg').html(),
@@ -0,0 +1,41 @@
1
+ import { Route } from '@/types';
2
+ import parser from '@/utils/rss-parser';
3
+ import { fetchArticle } from './utils';
4
+ const HOME_PAGE = 'https://apnews.com';
5
+
6
+ export const route: Route = {
7
+ path: '/rss/:rss?',
8
+ categories: ['traditional-media'],
9
+ example: '/apnews/rss/business',
10
+ parameters: { rss: 'Route name from the first segment of the corresponding site, or `index` for the front page(default).' },
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: ['apnews.com/:rss'],
22
+ target: '/rss/:rss',
23
+ },
24
+ ],
25
+ name: 'RSS',
26
+ maintainers: ['zoenglinghou', 'mjysci', 'TonyRL'],
27
+ handler,
28
+ };
29
+
30
+ async function handler(ctx) {
31
+ const { rss = 'index' } = ctx.req.param();
32
+ const url = `${HOME_PAGE}/${rss}.rss`;
33
+ const res = await parser.parseURL(url);
34
+
35
+ const items = await Promise.all(res.items.map((item) => fetchArticle(item)));
36
+
37
+ return {
38
+ ...rss,
39
+ item: items,
40
+ };
41
+ }