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
@@ -1,14 +1,14 @@
1
1
  import { Route } from '@/types';
2
2
  import cache from '@/utils/cache';
3
- import parser from '@/utils/rss-parser';
4
3
  import ofetch from '@/utils/ofetch';
5
4
  import { load } from 'cheerio';
5
+
6
6
  const host = 'https://www.newyorker.com';
7
7
  export const route: Route = {
8
- path: '/:category/:subCategory?',
8
+ path: '/:category',
9
9
  categories: ['traditional-media'],
10
- example: '/newyorker/everything',
11
- parameters: { category: 'rss category. can be found at `https://www.newyorker.com/about/feeds`' },
10
+ example: '/newyorker/latest',
11
+ parameters: { category: 'tab name. can be found at url' },
12
12
  features: {
13
13
  requireConfig: false,
14
14
  requirePuppeteer: false,
@@ -19,7 +19,7 @@ export const route: Route = {
19
19
  },
20
20
  radar: [
21
21
  {
22
- source: ['newyorker.com/feed/:category/:subCategory?'],
22
+ source: ['newyorker.com/:category?'],
23
23
  },
24
24
  ],
25
25
  name: 'The New Yorker',
@@ -28,13 +28,21 @@ export const route: Route = {
28
28
  };
29
29
 
30
30
  async function handler(ctx) {
31
- const { category, subCategory } = ctx.req.param();
32
- const rssUrl = subCategory ? `${host}/feed/${category}/${subCategory}` : `${host}/feed/${category}`;
33
- const feed = await parser.parseURL(rssUrl);
31
+ const { category } = ctx.req.param();
32
+ const link = `${host}/${category}`;
33
+ const response = await ofetch(link);
34
+ const $ = load(response);
35
+ const preloadedState = JSON.parse(
36
+ $('script:contains("window.__PRELOADED_STATE__")')
37
+ .text()
38
+ .match(/window\.__PRELOADED_STATE__ = (.*);/)?.[1] ?? '{}'
39
+ );
40
+ const list = preloadedState.transformed.bundle.containers[0].items;
34
41
  const items = await Promise.all(
35
- feed.items.map((item) =>
36
- cache.tryGet(item.link, async () => {
37
- const data = await ofetch(item.link);
42
+ list.map((item) => {
43
+ const url = `${host}${item.url}`;
44
+ return cache.tryGet(url, async () => {
45
+ const data = await ofetch(url);
38
46
  const $ = load(data);
39
47
  const description = $('#main-content');
40
48
  description.find('h1').remove();
@@ -43,18 +51,17 @@ async function handler(ctx) {
43
51
  description.find('div[class^="ActionBarWrapperContent-"]').remove();
44
52
  description.find('div[class^="ContentHeaderByline-"]').remove();
45
53
  return {
46
- title: item.title,
54
+ title: item.dangerousHed,
47
55
  pubDate: item.pubDate,
48
- link: item.link,
49
- category: item.categories,
56
+ link: url,
50
57
  description: description.html(),
51
58
  };
52
- })
53
- )
59
+ });
60
+ })
54
61
  );
55
62
 
56
63
  return {
57
- title: `The New Yorker - ${feed.title}`,
64
+ title: `The New Yorker - ${category}`,
58
65
  link: host,
59
66
  description: 'Reporting, Profiles, breaking news, cultural coverage, podcasts, videos, and cartoons from The New Yorker.',
60
67
  item: items,
@@ -85,6 +85,8 @@ async function handler(ctx) {
85
85
  });
86
86
  const $ = load(res.data);
87
87
 
88
+ $('.ad-wrap').remove();
89
+
88
90
  const list = $('.items .news-item')
89
91
  .toArray()
90
92
  .map((item) => {
@@ -32,7 +32,9 @@ async function handler(ctx) {
32
32
  responseType: 'buffer',
33
33
  });
34
34
 
35
- const $ = load(iconv.decode(response, 'gbk'));
35
+ const encoding = site === 'www' ? 'gbk' : 'utf-8';
36
+ const decodedResponse = iconv.decode(response, encoding);
37
+ const $ = load(decodedResponse);
36
38
 
37
39
  $('em').remove();
38
40
  $('.bshare-more, .page_n, .page').remove();
@@ -64,7 +66,7 @@ async function handler(ctx) {
64
66
  responseType: 'buffer',
65
67
  });
66
68
 
67
- const data = iconv.decode(detailResponse, 'gbk');
69
+ const data = iconv.decode(detailResponse, encoding);
68
70
  const content = load(data);
69
71
 
70
72
  content('.paper_num, #rwb_tjyd').remove();
@@ -82,7 +82,8 @@ async function handler(ctx) {
82
82
 
83
83
  const list = await Promise.all(
84
84
  posts.items.map(async (item) => {
85
- const { shortcode, type, sum_pure, time } = item;
85
+ const { shortcode, sum, type, time } = item;
86
+
86
87
  const link = `${baseUrl}/post/${shortcode}/`;
87
88
  if (type === 'img_multi') {
88
89
  item.images = await cache.tryGet(link, async () => {
@@ -111,8 +112,15 @@ async function handler(ctx) {
111
112
  }
112
113
 
113
114
  return {
114
- title: sum_pure,
115
- description: art(path.join(__dirname, 'templates/desc.art'), { item }),
115
+ // sum_pure lacks linebreaks/spaces between lines
116
+ title: load(sum, null, false).text().replaceAll('\n', ' '),
117
+ description: art(path.join(__dirname, 'templates/desc.art'), {
118
+ item: {
119
+ ...item,
120
+ // Fix linebreaks
121
+ sum: sum.replaceAll('\n', '<br>'),
122
+ },
123
+ }),
116
124
  link,
117
125
  pubDate: parseDate(time, 'X'),
118
126
  };
@@ -9,7 +9,7 @@ import { parseDate } from '@/utils/parse-date';
9
9
  import ConfigNotFoundError from '@/errors/types/config-not-found';
10
10
 
11
11
  export const route: Route = {
12
- path: '/search/:keyword/:order?/:mode?',
12
+ path: '/search/:keyword/:order?/:mode?/:include_ai?',
13
13
  categories: ['social-media', 'popular'],
14
14
  view: ViewType.Pictures,
15
15
  example: '/pixiv/search/Nezuko/popular',
@@ -47,6 +47,20 @@ export const route: Route = {
47
47
  },
48
48
  ],
49
49
  },
50
+ include_ai: {
51
+ description: 'whether AI-generated content is included',
52
+ default: 'yes',
53
+ options: [
54
+ {
55
+ label: 'does not include AI-generated content',
56
+ value: 'no',
57
+ },
58
+ {
59
+ label: 'include AI-generated content',
60
+ value: 'yes',
61
+ },
62
+ ],
63
+ },
50
64
  },
51
65
  features: {
52
66
  requireConfig: false,
@@ -69,6 +83,7 @@ async function handler(ctx) {
69
83
  const keyword = ctx.req.param('keyword');
70
84
  const order = ctx.req.param('order') || 'date';
71
85
  const mode = ctx.req.param('mode');
86
+ const includeAI = ctx.req.param('include_ai');
72
87
 
73
88
  const token = await getToken(cache.tryGet);
74
89
  if (!token) {
@@ -84,6 +99,10 @@ async function handler(ctx) {
84
99
  illusts = illusts.filter((item) => item.x_restrict === 1);
85
100
  }
86
101
 
102
+ if (includeAI === 'no' || includeAI === '0') {
103
+ illusts = illusts.filter((item) => item.illust_ai_type <= 1);
104
+ }
105
+
87
106
  return {
88
107
  title: `${keyword} 的 pixiv ${order === 'popular' ? '热门' : ''}内容`,
89
108
  link: `https://www.pixiv.net/tags/${keyword}/artworks`,
@@ -2,15 +2,15 @@ import { config } from '@/config';
2
2
 
3
3
  export default {
4
4
  getImgs(illust) {
5
- const images = [];
5
+ const images: string[] = [];
6
6
  if (illust.meta_pages?.length) {
7
7
  for (const page of illust.meta_pages) {
8
8
  const original = page.image_urls.original.replace('https://i.pximg.net', config.pixiv.imgProxy);
9
- images.push(`<p><img src="${original}"/></p>`);
9
+ images.push(`<p><img src="${original}" width="${page.width}" height="${page.height}" /></p>`);
10
10
  }
11
11
  } else if (illust.meta_single_page.original_image_url) {
12
12
  const original = illust.meta_single_page.original_image_url.replace('https://i.pximg.net', config.pixiv.imgProxy);
13
- images.push(`<p><img src="${original}"/></p>`);
13
+ images.push(`<p><img src="${original}" width="${illust.width}" height="${illust.height}" /></p>`);
14
14
  }
15
15
  return images;
16
16
  },
@@ -1,6 +1,6 @@
1
1
  import { Route } from '@/types';
2
2
  import { load } from 'cheerio';
3
- import { ofetch } from 'ofetch';
3
+ import ofetch from '@/utils/ofetch';
4
4
  import { getData } from './utils';
5
5
 
6
6
  export const route: Route = {
@@ -1,7 +1,7 @@
1
1
  import { Route } from '@/types';
2
2
  import { load } from 'cheerio';
3
3
  import { getData } from './utils';
4
- import { ofetch } from 'ofetch';
4
+ import ofetch from '@/utils/ofetch';
5
5
 
6
6
  export const route: Route = {
7
7
  path: '/type/:type',
@@ -2,7 +2,7 @@ import { getCurrentPath } from '@/utils/helpers';
2
2
  const __dirname = getCurrentPath(import.meta.url);
3
3
 
4
4
  import cache from '@/utils/cache';
5
- import { ofetch } from 'ofetch';
5
+ import ofetch from '@/utils/ofetch';
6
6
  import { load } from 'cheerio';
7
7
  import { art } from '@/utils/render';
8
8
  import path from 'node:path';
@@ -0,0 +1,76 @@
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: '/community/:communityUrl',
7
+ name: 'Community Events',
8
+ url: 'app.questn.com',
9
+ maintainers: ['cxheng315'],
10
+ example: '/questn/community/gmnetwork',
11
+ parameters: {
12
+ community_url: 'Community URL',
13
+ },
14
+ categories: ['other'],
15
+ features: {
16
+ requireConfig: false,
17
+ requirePuppeteer: false,
18
+ antiCrawler: false,
19
+ supportBT: false,
20
+ supportPodcast: false,
21
+ supportScihub: false,
22
+ },
23
+ radar: [
24
+ {
25
+ source: ['app.questn.com/:communityUrl'],
26
+ target: '/community/:communityUrl',
27
+ },
28
+ ],
29
+ handler,
30
+ };
31
+
32
+ async function handler(ctx) {
33
+ const url = 'https://api.questn.com/consumer/explore/entity_list/';
34
+
35
+ const params = {
36
+ count: ctx.req.query('limit') || '20',
37
+ page: '1',
38
+ community_url: ctx.req.param('communityUrl') || 'questn', // default to questn
39
+ };
40
+
41
+ const response = await ofetch(`${url}?${new URLSearchParams(params)}`, {
42
+ method: 'GET',
43
+ headers: {
44
+ 'Content-Type': 'application/json',
45
+ },
46
+ });
47
+
48
+ const data = await response.result.data;
49
+
50
+ const items = data.map((item) => ({
51
+ title: item.title,
52
+ link: `https://app.questn.com/quest/${item.id}`,
53
+ author: item.community_info ? item.community_info.name : '',
54
+ guid: item.id,
55
+ pubDate: parseDate(item.start_time * 1000),
56
+ itunes_duration: item.end_time > 0 ? item.end_time - item.start_time : 0,
57
+ }));
58
+
59
+ return {
60
+ title: `QuestN Community - ${data[0].community_info ? data[0].community_info.name : ''} Events`,
61
+ link: `https://app.questn.com/${ctx.req.param('community_url')}`,
62
+ description: data[0].community_info ? data[0].community_info.introduction : '',
63
+ image: data[0].community_info ? data[0].community_info.logo : '',
64
+ logo: data[0].community_info ? data[0].community_info.logo : '',
65
+ item:
66
+ items && items.length > 0
67
+ ? items
68
+ : [
69
+ {
70
+ title: 'No events found',
71
+ link: `https://app.questn.com/${ctx.req.param('community_url')}`,
72
+ description: 'No events found',
73
+ },
74
+ ],
75
+ };
76
+ }
@@ -0,0 +1,101 @@
1
+ import { Route } from '@/types';
2
+ import { parseDate } from '@/utils/parse-date';
3
+ import ofetch from '@/utils/ofetch';
4
+
5
+ import { parseFilterStr } from './util';
6
+
7
+ export const route: Route = {
8
+ path: '/events/:filter?',
9
+ name: 'Events',
10
+ url: 'app.questn.com',
11
+ maintainers: ['cxheng315'],
12
+ example: '/questn/events',
13
+ parameters: {
14
+ filter: 'Filter string',
15
+ },
16
+ description: `
17
+ :::tip
18
+
19
+ Filter parameters:
20
+ - category: 100: trending, 200: newest, 300: top
21
+ - status_filter: 0: all, 100: available, 400: missed
22
+ - community_filter: 0: all community, 100: verified, 200: followed
23
+ - rewards_filter: 0: all rewards, 100: nft, 200: token, 400: whitelist
24
+ - chain_filter: 0: all chains, 1: ethereum, 56: bsc, 137: polygon, 42161: arb, 10: op, 324: zksync, 43114: avax
25
+ - search: 'Search keyword',
26
+ - count: 'Number of events to fetch',
27
+ - page: 'Page number',
28
+ :::`,
29
+ categories: ['other'],
30
+ features: {
31
+ requireConfig: false,
32
+ requirePuppeteer: false,
33
+ antiCrawler: false,
34
+ supportBT: false,
35
+ supportPodcast: false,
36
+ supportScihub: false,
37
+ },
38
+ radar: [
39
+ {
40
+ source: ['app.questn.com/explore'],
41
+ target: '/events/:category?/:status_filter?/:community_filter?/:reward_filter?/:chain_filter?/:search?/:count?/:page?',
42
+ },
43
+ ],
44
+ handler,
45
+ };
46
+
47
+ async function handler(ctx) {
48
+ const url = 'https://api.questn.com/consumer/explore/list/';
49
+
50
+ const parsedFilter: { category?: string; status_filter?: string; community_filter?: string; reward_filter?: string; chain_filter?: string; search?: string; count?: string; page?: string } = parseFilterStr(
51
+ ctx.req.param('filter')
52
+ );
53
+
54
+ const params = {
55
+ category: parsedFilter.category || '200',
56
+ status_filter: parsedFilter.status_filter || '100',
57
+ community_filter: parsedFilter.community_filter || '0',
58
+ rewards_filter: parsedFilter.reward_filter || '0',
59
+ chain_filter: parsedFilter.chain_filter || '0',
60
+ search: parsedFilter.search || '',
61
+ count: parsedFilter.count || ctx.req.query('limit') || '20',
62
+ page: parsedFilter.page || '1',
63
+ };
64
+
65
+ const response = await ofetch(`${url}?${new URLSearchParams(params)}`, {
66
+ method: 'GET',
67
+ headers: {
68
+ 'Content-Type': 'application/json',
69
+ },
70
+ });
71
+
72
+ const data = await response.result.data;
73
+
74
+ const items = data.map((item) => ({
75
+ title: item.title,
76
+ link: `https://app.questn.com/quest/${item.id}`,
77
+ author: item.community_info ? item.community_info.name : '',
78
+ guid: item.id,
79
+ pubDate: parseDate(item.start_time * 1000),
80
+ itunes_duration: item.end_time > 0 ? item.end_time - item.start_time : 0,
81
+ }));
82
+
83
+ return {
84
+ title: 'QuestN Events',
85
+ link: 'https://app.questn.com/explore',
86
+ description: 'A Quest Protocol Dedicated to DePIN and AI Training',
87
+ image: 'https://app.questn.com/static/svgs/logo-white.svg',
88
+ logo: 'https://app.questn.com/static/svgs/logo-white.svg',
89
+ author: 'QuestN',
90
+ item:
91
+ items && items.length > 0
92
+ ? items
93
+ : [
94
+ {
95
+ title: 'No events found',
96
+ description: 'No events found',
97
+ link: 'https://app.questn.com/explore',
98
+ },
99
+ ],
100
+ };
101
+ }
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'QuestN',
5
+ url: 'app.questn.com',
6
+ };
@@ -0,0 +1,16 @@
1
+ const parseFilterStr = (filterStr) => {
2
+ const filters = {};
3
+ if (!filterStr) {
4
+ return filters;
5
+ }
6
+ const filterPairs = filterStr.split('&'); // Split by '&'
7
+
8
+ for (const pair of filterPairs) {
9
+ const [key, value] = pair.split('='); // Split by '='
10
+ filters[key] = value;
11
+ }
12
+
13
+ return filters;
14
+ };
15
+
16
+ export { parseFilterStr };
@@ -0,0 +1,35 @@
1
+ import { Route } from '@/types';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { parseDate } from '@/utils/parse-date';
4
+
5
+ export const route: Route = {
6
+ path: '/geekdaily',
7
+ categories: ['new-media'],
8
+ example: '/rebase/geekdaily',
9
+ radar: [
10
+ {
11
+ source: ['rebase.network/geekdaily'],
12
+ target: '/geekdaily',
13
+ },
14
+ ],
15
+ name: 'Web3 Geek Daily',
16
+ maintainers: ['gaoyifan'],
17
+ handler: async () => {
18
+ const response = await ofetch('https://db.rebase.network/api/v1/geekdailies?sort=id:desc');
19
+ const data = response.data;
20
+
21
+ const items = data.map((item) => ({
22
+ title: item.attributes.title,
23
+ link: item.attributes.url,
24
+ description: item.attributes.introduce,
25
+ pubDate: parseDate(item.attributes.time),
26
+ author: item.attributes.author,
27
+ }));
28
+
29
+ return {
30
+ title: 'Web3 Geek Daily',
31
+ link: 'https://rebase.network/geekdaily',
32
+ item: items,
33
+ };
34
+ },
35
+ };
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Rebase Network',
5
+ url: 'rebase.network',
6
+ };
@@ -1,6 +1,8 @@
1
- import { Route } from '@/types';
1
+ import { Route, type DataItem } from '@/types';
2
2
 
3
+ import { camelcaseKeys } from '@/utils/camelcase-keys';
3
4
  import ofetch from '@/utils/ofetch';
5
+ import { renderItemActionToHTML } from '@rss3/sdk';
4
6
 
5
7
  export const route: Route = {
6
8
  path: '/:account/:network?/:tag?',
@@ -132,17 +134,24 @@ async function handler(ctx) {
132
134
  return {
133
135
  title: `${account} activities`,
134
136
  link: 'https://rss3.io',
135
- item: data.map((item) => ({
136
- title: `New ${item.tag} ${item.type} action on ${item.network}`,
137
- description: `New ${item.tag} ${item.type} action on ${item.network}<br /><br />From: ${item.from}<br/>To: ${item.to}`,
138
- link: item.actions?.[0]?.related_urls?.[0],
139
- guid: item.id,
140
- author: [
141
- {
142
- name: item.owner,
143
- avatar: `https://cdn.stamp.fyi/avatar/eth:${item.owner}`,
144
- },
145
- ],
146
- })),
137
+ item: data.map((item) => {
138
+ const content = renderItemActionToHTML(camelcaseKeys(item.actions));
139
+
140
+ const description = `New ${item.tag} ${item.type} action on ${item.network}<br /><br />From: ${item.from}<br/>To: ${item.to}`;
141
+ return {
142
+ title: `New ${item.tag} ${item.type} action on ${item.network}`,
143
+ description: content ? `${description}<br /><br />${content}` : description,
144
+ link: item.actions?.[0]?.related_urls?.[0],
145
+ guid: item.id,
146
+ author: [
147
+ {
148
+ name: item.owner,
149
+ avatar: `https://cdn.stamp.fyi/avatar/eth:${item.owner}`,
150
+ },
151
+ ],
152
+
153
+ _extra: { raw: item },
154
+ } as DataItem;
155
+ }),
147
156
  };
148
157
  }
@@ -0,0 +1,67 @@
1
+ import {
2
+ CollectibleApproval,
3
+ CollectibleBurn,
4
+ CollectibleMint,
5
+ CollectibleTrade,
6
+ CollectibleTransfer,
7
+ ExchangeLiquidity,
8
+ ExchangeStaking,
9
+ ExchangeSwap,
10
+ MetaverseBurn,
11
+ MetaverseMint,
12
+ MetaverseTrade,
13
+ MetaverseTransfer,
14
+ SocialComment,
15
+ SocialDelete,
16
+ SocialMint,
17
+ SocialPost,
18
+ SocialProfile,
19
+ SocialProxy,
20
+ SocialRevise,
21
+ SocialReward,
22
+ SocialShare,
23
+ StakeStaking,
24
+ StakeTransaction,
25
+ StakerProfitSnapshot,
26
+ TransactionApproval,
27
+ TransactionBridge,
28
+ TransactionBurn,
29
+ TransactionEvent,
30
+ TransactionMint,
31
+ TransactionTransfer,
32
+ } from '@rss3/sdk';
33
+ export type RSS3DataModels = {
34
+ CollectibleApproval: CollectibleApproval;
35
+ CollectibleBurn: CollectibleBurn;
36
+ CollectibleMint: CollectibleMint;
37
+ CollectibleTrade: CollectibleTrade;
38
+ CollectibleTransfer: CollectibleTransfer;
39
+ MetaverseBurn: MetaverseBurn;
40
+ MetaverseMint: MetaverseMint;
41
+ MetaverseTrade: MetaverseTrade;
42
+ MetaverseTransfer: MetaverseTransfer;
43
+ SocialComment: SocialComment;
44
+ SocialDelete: SocialDelete;
45
+ SocialMint: SocialMint;
46
+ SocialPost: SocialPost;
47
+ SocialProfile: SocialProfile;
48
+ SocialProxy: SocialProxy;
49
+ SocialRevise: SocialRevise;
50
+ SocialReward: SocialReward;
51
+ SocialShare: SocialShare;
52
+ StakeStaking: StakeStaking;
53
+ StakeTransaction: StakeTransaction;
54
+ StakerProfitSnapshot: StakerProfitSnapshot;
55
+ TransactionApproval: TransactionApproval;
56
+ TransactionBridge: TransactionBridge;
57
+ TransactionBurn: TransactionBurn;
58
+ TransactionEvent: TransactionEvent;
59
+ TransactionMint: TransactionMint;
60
+ TransactionTransfer: TransactionTransfer;
61
+ ExchangeLiquidity: ExchangeLiquidity;
62
+ ExchangeStaking: ExchangeStaking;
63
+ ExchangeSwap: ExchangeSwap;
64
+ };
65
+ export type GetRSS3DataMetadata<FirstKey extends string, SecondKey extends string> = `${Capitalize<FirstKey>}${Capitalize<SecondKey>}` extends keyof RSS3DataModels
66
+ ? RSS3DataModels[`${Capitalize<FirstKey>}${Capitalize<SecondKey>}`]
67
+ : null;
@@ -1,6 +1,6 @@
1
1
  import { Route, ViewType } from '@/types';
2
- import got from '@/utils/got';
3
- import { load } from 'cheerio';
2
+ import ofetch from '@/utils/ofetch';
3
+ import * as cheerio from 'cheerio';
4
4
 
5
5
  export const route: Route = {
6
6
  path: '/routes/:lang?',
@@ -66,11 +66,9 @@ async function handler(ctx) {
66
66
  ];
67
67
  const all = await Promise.all(
68
68
  types.map(async (type) => {
69
- const response = await got(`https://docs.rsshub.app/${lang}routes/${type}`);
69
+ const response = await ofetch(`https://docs.rsshub.app/${lang}routes/${type}`);
70
70
 
71
- const data = response.data;
72
-
73
- const $ = load(data);
71
+ const $ = cheerio.load(response);
74
72
  const page = $('.page').toArray();
75
73
  const item = $('.routeBlock').toArray();
76
74
  return { page, item, type };
@@ -84,15 +82,23 @@ async function handler(ctx) {
84
82
  description: isEnglish ? 'Everything is RSSible' : '万物皆可 RSS',
85
83
  language: isEnglish ? 'en-us' : 'zh-cn',
86
84
  item: list.map(({ page, item, type }) => {
87
- const $ = load(page);
88
- item = $(item);
89
- const h2Title = item.prevAll('h2').eq(0);
90
- const h3Title = item.prevAll('h3').eq(0);
85
+ const $ = cheerio.load(page);
86
+ const $item = $(item);
87
+ const h2Title = $item.prevAll('h2').eq(0);
88
+ const h3Title = $item.prevAll('h3').eq(0);
89
+
90
+ $item.find('.VPBadge').each((_, ele) => {
91
+ const $ele = $(ele);
92
+ if ($ele.text().includes('Test')) {
93
+ $ele.remove();
94
+ }
95
+ });
96
+
91
97
  return {
92
98
  title: `${h2Title.text().trim()} - ${h3Title.text().trim()}`,
93
- description: item.html(),
99
+ description: $item.html()?.replaceAll(/<!--.*?-->/g, ''),
94
100
  link: `https://docs.rsshub.app/${lang}routes/${type}#${encodeURIComponent(h2Title.find('.header-anchor').attr('href') && h3Title.find('.header-anchor').attr('href')?.substring(1))}`,
95
- guid: item.attr('id'),
101
+ guid: $item.attr('id'),
96
102
  };
97
103
  }),
98
104
  };
@@ -3,7 +3,7 @@ import cache from '@/utils/cache';
3
3
  import { parseDate } from '@/utils/parse-date';
4
4
  import timezone from '@/utils/timezone';
5
5
  import { load } from 'cheerio';
6
- import { ofetch } from 'ofetch';
6
+ import ofetch from '@/utils/ofetch';
7
7
 
8
8
  const dict = { '434': '行业资讯', '436': '协会动态', '438': '重要通知', '440': '政策法规' };
9
9