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,77 +1,350 @@
1
1
  import { Route } from '@/types';
2
+
2
3
  import cache from '@/utils/cache';
3
4
  import got from '@/utils/got';
4
5
  import { load } from 'cheerio';
5
6
  import { parseDate } from '@/utils/parse-date';
6
7
 
7
- export const route: Route = {
8
- path: '/rule',
9
- categories: ['finance'],
10
- example: '/szse/rule',
11
- parameters: {},
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: ['szse.cn/lawrules/rule/new', 'szse.cn/'],
23
- },
24
- ],
25
- name: '最新规则',
26
- maintainers: ['nczitzk'],
27
- handler,
28
- url: 'szse.cn/lawrules/rule/new',
29
- };
8
+ export const handler = async (ctx) => {
9
+ const { channel = 'allrules/bussiness' } = ctx.req.param();
10
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
11
+
12
+ const rootUrl = 'https://www.szse.cn';
13
+ const apiUrl = new URL('api/search/content', rootUrl).href;
14
+ const currentUrl = new URL(`www/lawrules/rule/${channel}/`, rootUrl).href;
15
+
16
+ const { data: currentResponse } = await got(currentUrl);
30
17
 
31
- async function handler() {
32
- const rootUrl = 'http://www.szse.cn';
33
- const currentUrl = `${rootUrl}/api/search/content`;
18
+ const $ = load(currentResponse);
34
19
 
35
- const response = await got({
36
- method: 'post',
37
- url: currentUrl,
20
+ const channelEl = $('ul.side-menu-con li.active').last();
21
+ const channelCode = channelEl.prop('chnlcode');
22
+
23
+ const { data: response } = await got.post(apiUrl, {
38
24
  form: {
39
25
  keyword: '',
40
26
  time: 0,
41
27
  range: 'title',
42
- 'channelCode[]': 'szserulesAllRulesBuss',
28
+ 'channelCode[]': channelCode,
43
29
  currentPage: 1,
44
- pageSize: 30,
30
+ pageSize: limit,
45
31
  scope: 0,
46
32
  },
47
33
  });
48
34
 
49
- let items = response.data.data.map((item) => ({
35
+ let items = response.data.slice(0, limit).map((item) => ({
50
36
  title: item.doctitle,
37
+ pubDate: parseDate(item.docpubtime, 'X'),
51
38
  link: item.docpuburl,
52
- pubDate: parseDate(item.docpubtime),
39
+ category: item.navigation,
53
40
  }));
54
41
 
55
42
  items = await Promise.all(
56
43
  items.map((item) =>
57
44
  cache.tryGet(item.link, async () => {
58
- const detailResponse = await got({
59
- method: 'get',
60
- url: item.link,
61
- });
45
+ const { data: detailResponse } = await got(item.link);
46
+
47
+ const $$ = load(detailResponse);
62
48
 
63
- const content = load(detailResponse.data);
49
+ const title = $$('h2.title').text();
50
+ const description = $$('div#desContent').html();
64
51
 
65
- item.description = content('#desContent').html();
52
+ item.title = title;
53
+ item.description = description;
54
+ item.pubDate = item.pubDate ?? parseDate($$('div.time span').text());
55
+ item.author = $$('meta[name="author"]').prop('content');
56
+ item.content = {
57
+ html: description,
58
+ text: $$('div#desContent').text(),
59
+ };
60
+ item.language = $$('html').prop('lang');
66
61
 
67
62
  return item;
68
63
  })
69
64
  )
70
65
  );
71
66
 
67
+ const image = $('a.navbar-brand img').prop('src');
68
+
72
69
  return {
73
- title: '最新规则 - 深圳证券交易所',
74
- link: `${rootUrl}/lawrules/rule/new`,
70
+ title: `深圳证券交易所 - ${channelEl.text()}`,
71
+ description: $('meta[name="description"]').prop('content'),
72
+ link: currentUrl,
75
73
  item: items,
74
+ allowEmpty: true,
75
+ image,
76
+ author: $('meta[name="author"]').prop('content'),
77
+ language: $('html').prop('lang'),
76
78
  };
77
- }
79
+ };
80
+
81
+ export const route: Route = {
82
+ path: '/rule/:channel{.+}?',
83
+ name: '本所业务规则',
84
+ url: 'www.szse.cn',
85
+ maintainers: ['nczitzk'],
86
+ handler,
87
+ example: '/szse/rule/allrules/bussiness',
88
+ parameters: { channel: '频道,默认为 `allrules/bussiness`,即全部业务规则,可在对应频道页 URL 中找到' },
89
+ description: `:::tip
90
+ 若订阅 [综合类](https://www.szse.cn/www/lawrules/rule/all/index.html),网址为 \`https://www.szse.cn/www/lawrules/rule/all/index.html\`。截取 \`https://www.szse.cn/www/lawrules/rule/\` 到末尾 \`/index.html\` 的部分 \`all\` 作为参数填入,此时路由为 [\`/szse/rule/all\`](https://rsshub.app/szse/rule/all)。
91
+ :::
92
+
93
+ | 频道 | ID |
94
+ | --------------------------------------------------------------------------- | ----------------------------------------------------- |
95
+ | [综合类](https://www.szse.cn/www/lawrules/rule/all/index.html) | [all](https://rsshub.app/szes/rule/all) |
96
+ | [基础设施REITs类](https://www.szse.cn/www/lawrules/rule/reits/index.html) | [reits](https://rsshub.app/szes/rule/reits) |
97
+ | [衍生品类](https://www.szse.cn/www/lawrules/rule/derivative/index.html) | [derivative](https://rsshub.app/szes/rule/derivative) |
98
+ | [会员管理类](https://www.szse.cn/www/lawrules/rule/memberty/index.html) | [memberty](https://rsshub.app/szes/rule/memberty) |
99
+ | [纪律处分与内部救济类](https://www.szse.cn/www/lawrules/rule/pr/index.html) | [pr](https://rsshub.app/szes/rule/pr) |
100
+
101
+ #### 股票类
102
+
103
+ | 频道 | ID |
104
+ | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
105
+ | [发行上市审核](https://www.szse.cn/www/lawrules/rule/stock/audit/index.html) | [stock/audit](https://rsshub.app/szes/rule/stock/audit) |
106
+ | [发行承销](https://www.szse.cn/www/lawrules/rule/stock/issue/index.html) | [stock/issue](https://rsshub.app/szes/rule/stock/issue) |
107
+ | [通用](https://www.szse.cn/www/lawrules/rule/stock/supervision/currency/index.html) | [stock/supervision/currency](https://rsshub.app/szes/rule/stock/supervision/currency) |
108
+ | [主板专用](https://www.szse.cn/www/lawrules/rule/stock/supervision/mb/index.html) | [stock/supervision/mb](https://rsshub.app/szes/rule/stock/supervision/mb) |
109
+ | [创业板专用](https://www.szse.cn/www/lawrules/rule/stock/supervision/chinext/index.html) | [stock/supervision/chinext](https://rsshub.app/szes/rule/stock/supervision/chinext) |
110
+ | [交易](https://www.szse.cn/www/lawrules/rule/stock/trade/index.html) | [stock/trade](https://rsshub.app/szes/rule/stock/trade) |
111
+
112
+ #### 固收类
113
+
114
+ | 频道 | ID |
115
+ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
116
+ | [发行上市(挂牌)](https://www.szse.cn/www/lawrules/rule/bond/bonds/list/index.html) | [bond/bonds/list](https://rsshub.app/szes/rule/bond/bonds/list) |
117
+ | [持续监管](https://www.szse.cn/www/lawrules/rule/bond/bonds/supervision/index.html) | [bond/bonds/supervision](https://rsshub.app/szes/rule/bond/bonds/supervision) |
118
+ | [交易](https://www.szse.cn/www/lawrules/rule/bond/bonds/trade/index.html) | [bond/bonds/trade](https://rsshub.app/szes/rule/bond/bonds/trade) |
119
+ | [资产支持证券](https://www.szse.cn/www/lawrules/rule/bond/abs/index.html) | [bond/abs](https://rsshub.app/szes/rule/bond/abs) |
120
+
121
+ #### 基金类
122
+
123
+ | 频道 | ID |
124
+ | ------------------------------------------------------------------- | ----------------------------------------------------- |
125
+ | [上市](https://www.szse.cn/www/lawrules/rule/fund/list/index.html) | [fund/list](https://rsshub.app/szes/rule/fund/list) |
126
+ | [交易](https://www.szse.cn/www/lawrules/rule/fund/trade/index.html) | [fund/trade](https://rsshub.app/szes/rule/fund/trade) |
127
+
128
+ #### 交易类
129
+
130
+ | 频道 | ID |
131
+ | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
132
+ | [通用](https://www.szse.cn/www/lawrules/rule/trade/current/index.html) | [trade/current](https://rsshub.app/szes/rule/trade/current) |
133
+ | [融资融券](https://www.szse.cn/www/lawrules/rule/trade/business/margin/index.html) | [trade/business/margin](https://rsshub.app/szes/rule/trade/business/margin) |
134
+ | [转融通](https://www.szse.cn/www/lawrules/rule/trade/business/refinancing/index.html) | [trade/business/refinancing](https://rsshub.app/szes/rule/trade/business/refinancing) |
135
+ | [股票质押式回购](https://www.szse.cn/www/lawrules/rule/trade/business/pledge/index.html) | [trade/business/pledge](https://rsshub.app/szes/rule/trade/business/pledge) |
136
+ | [质押式报价回购](https://www.szse.cn/www/lawrules/rule/trade/business/price/index.html) | [trade/business/price](https://rsshub.app/szes/rule/trade/business/price) |
137
+ | [约定购回](https://www.szse.cn/www/lawrules/rule/trade/business/promise/index.html) | [trade/business/promise](https://rsshub.app/szes/rule/trade/business/promise) |
138
+ | [协议转让](https://www.szse.cn/www/lawrules/rule/trade/business/transfer/index.html) | [trade/business/transfer](https://rsshub.app/szes/rule/trade/business/transfer) |
139
+ | [其他](https://www.szse.cn/www/lawrules/rule/trade/business/oth/index.html) | [trade/business/oth](https://rsshub.app/szes/rule/trade/business/oth) |
140
+
141
+ #### 跨境创新类
142
+
143
+ | 频道 | ID |
144
+ | ----------------------------------------------------------------------------- | ----------------------------------------------------- |
145
+ | [深港通](https://www.szse.cn/www/lawrules/rule/inno/szhk/index.html) | [inno/szhk](https://rsshub.app/szes/rule/inno/szhk) |
146
+ | [试点创新企业](https://www.szse.cn/www/lawrules/rule/inno/pilot/index.html) | [inno/pilot](https://rsshub.app/szes/rule/inno/pilot) |
147
+ | [H股全流通](https://www.szse.cn/www/lawrules/rule/inno/hc/index.html) | [inno/hc](https://rsshub.app/szes/rule/inno/hc) |
148
+ | [互联互通存托凭证](https://www.szse.cn/www/lawrules/rule/inno/gdr/index.html) | [inno/gdr](https://rsshub.app/szes/rule/inno/gdr) |
149
+
150
+ #### 全部规则
151
+
152
+ | 频道 | ID |
153
+ | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
154
+ | [全部业务规则](https://www.szse.cn/www/lawrules/rule/allrules/bussiness/index.html) | [allrules/bussiness](https://rsshub.app/szes/rule/allrules/bussiness) |
155
+ | [规则汇编下载](https://www.szse.cn/www/lawrules/rule/allrules/rulejoin/index.html) | [allrules/rulejoin](https://rsshub.app/szes/rule/allrules/rulejoin) |
156
+
157
+ #### 已废止规则
158
+
159
+ | 频道 | ID |
160
+ | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
161
+ | [规则废止公告](https://www.szse.cn/www/lawrules/rule/repeal/announcement/index.html) | [repeal/announcement](https://rsshub.app/szes/rule/repeal/announcement) |
162
+ | [已废止规则文本](https://www.szse.cn/www/lawrules/rule/repeal/rules/index.html) | [repeal/rules](https://rsshub.app/szes/rule/repeal/rules) |
163
+ `,
164
+ categories: ['finance'],
165
+
166
+ features: {
167
+ requireConfig: false,
168
+ requirePuppeteer: false,
169
+ antiCrawler: false,
170
+ supportRadar: true,
171
+ supportBT: false,
172
+ supportPodcast: false,
173
+ supportScihub: false,
174
+ },
175
+ radar: [
176
+ {
177
+ source: ['www.szse.cn/www/lawrules/rule/:category'],
178
+ target: (params) => {
179
+ const category = params.category;
180
+
181
+ return `/szse/rule${category ? `/${category}` : ''}`;
182
+ },
183
+ },
184
+ {
185
+ title: '综合类',
186
+ source: ['www.szse.cn/www/lawrules/rule/all/index.html'],
187
+ target: '/rule/all',
188
+ },
189
+ {
190
+ title: '基础设施REITs类',
191
+ source: ['www.szse.cn/www/lawrules/rule/reits/index.html'],
192
+ target: '/rule/reits',
193
+ },
194
+ {
195
+ title: '衍生品类',
196
+ source: ['www.szse.cn/www/lawrules/rule/derivative/index.html'],
197
+ target: '/rule/derivative',
198
+ },
199
+ {
200
+ title: '会员管理类',
201
+ source: ['www.szse.cn/www/lawrules/rule/memberty/index.html'],
202
+ target: '/rule/memberty',
203
+ },
204
+ {
205
+ title: '纪律处分与内部救济类',
206
+ source: ['www.szse.cn/www/lawrules/rule/pr/index.html'],
207
+ target: '/rule/pr',
208
+ },
209
+ {
210
+ title: '股票类 - 发行上市审核',
211
+ source: ['www.szse.cn/www/lawrules/rule/stock/audit/index.html'],
212
+ target: '/rule/stock/audit',
213
+ },
214
+ {
215
+ title: '股票类 - 发行承销',
216
+ source: ['www.szse.cn/www/lawrules/rule/stock/issue/index.html'],
217
+ target: '/rule/stock/issue',
218
+ },
219
+ {
220
+ title: '股票类 - 通用',
221
+ source: ['www.szse.cn/www/lawrules/rule/stock/supervision/currency/index.html'],
222
+ target: '/rule/stock/supervision/currency',
223
+ },
224
+ {
225
+ title: '股票类 - 主板专用',
226
+ source: ['www.szse.cn/www/lawrules/rule/stock/supervision/mb/index.html'],
227
+ target: '/rule/stock/supervision/mb',
228
+ },
229
+ {
230
+ title: '股票类 - 创业板专用',
231
+ source: ['www.szse.cn/www/lawrules/rule/stock/supervision/chinext/index.html'],
232
+ target: '/rule/stock/supervision/chinext',
233
+ },
234
+ {
235
+ title: '股票类 - 交易',
236
+ source: ['www.szse.cn/www/lawrules/rule/stock/trade/index.html'],
237
+ target: '/rule/stock/trade',
238
+ },
239
+ {
240
+ title: '固收类 - 发行上市(挂牌)',
241
+ source: ['www.szse.cn/www/lawrules/rule/bond/bonds/list/index.html'],
242
+ target: '/rule/bond/bonds/list',
243
+ },
244
+ {
245
+ title: '固收类 - 持续监管',
246
+ source: ['www.szse.cn/www/lawrules/rule/bond/bonds/supervision/index.html'],
247
+ target: '/rule/bond/bonds/supervision',
248
+ },
249
+ {
250
+ title: '固收类 - 交易',
251
+ source: ['www.szse.cn/www/lawrules/rule/bond/bonds/trade/index.html'],
252
+ target: '/rule/bond/bonds/trade',
253
+ },
254
+ {
255
+ title: '固收类 - 资产支持证券',
256
+ source: ['www.szse.cn/www/lawrules/rule/bond/abs/index.html'],
257
+ target: '/rule/bond/abs',
258
+ },
259
+ {
260
+ title: '基金类 - 上市',
261
+ source: ['www.szse.cn/www/lawrules/rule/fund/list/index.html'],
262
+ target: '/rule/fund/list',
263
+ },
264
+ {
265
+ title: '基金类 - 交易',
266
+ source: ['www.szse.cn/www/lawrules/rule/fund/trade/index.html'],
267
+ target: '/rule/fund/trade',
268
+ },
269
+ {
270
+ title: '交易类 - 通用',
271
+ source: ['www.szse.cn/www/lawrules/rule/trade/current/index.html'],
272
+ target: '/rule/trade/current',
273
+ },
274
+ {
275
+ title: '交易类 - 融资融券',
276
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/margin/index.html'],
277
+ target: '/rule/trade/business/margin',
278
+ },
279
+ {
280
+ title: '交易类 - 转融通',
281
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/refinancing/index.html'],
282
+ target: '/rule/trade/business/refinancing',
283
+ },
284
+ {
285
+ title: '交易类 - 股票质押式回购',
286
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/pledge/index.html'],
287
+ target: '/rule/trade/business/pledge',
288
+ },
289
+ {
290
+ title: '交易类 - 质押式报价回购',
291
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/price/index.html'],
292
+ target: '/rule/trade/business/price',
293
+ },
294
+ {
295
+ title: '交易类 - 约定购回',
296
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/promise/index.html'],
297
+ target: '/rule/trade/business/promise',
298
+ },
299
+ {
300
+ title: '交易类 - 协议转让',
301
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/transfer/index.html'],
302
+ target: '/rule/trade/business/transfer',
303
+ },
304
+ {
305
+ title: '交易类 - 其他',
306
+ source: ['www.szse.cn/www/lawrules/rule/trade/business/oth/index.html'],
307
+ target: '/rule/trade/business/oth',
308
+ },
309
+ {
310
+ title: '跨境创新类 - 深港通',
311
+ source: ['www.szse.cn/www/lawrules/rule/inno/szhk/index.html'],
312
+ target: '/rule/inno/szhk',
313
+ },
314
+ {
315
+ title: '跨境创新类 - 试点创新企业',
316
+ source: ['www.szse.cn/www/lawrules/rule/inno/pilot/index.html'],
317
+ target: '/rule/inno/pilot',
318
+ },
319
+ {
320
+ title: '跨境创新类 - H股全流通',
321
+ source: ['www.szse.cn/www/lawrules/rule/inno/hc/index.html'],
322
+ target: '/rule/inno/hc',
323
+ },
324
+ {
325
+ title: '跨境创新类 - 互联互通存托凭证',
326
+ source: ['www.szse.cn/www/lawrules/rule/inno/gdr/index.html'],
327
+ target: '/rule/inno/gdr',
328
+ },
329
+ {
330
+ title: '全部规则 - 全部业务规则',
331
+ source: ['www.szse.cn/www/lawrules/rule/allrules/bussiness/index.html'],
332
+ target: '/rule/allrules/bussiness',
333
+ },
334
+ {
335
+ title: '全部规则 - 规则汇编下载',
336
+ source: ['www.szse.cn/www/lawrules/rule/allrules/rulejoin/index.html'],
337
+ target: '/rule/allrules/rulejoin',
338
+ },
339
+ {
340
+ title: '已废止规则 - 规则废止公告',
341
+ source: ['www.szse.cn/www/lawrules/rule/repeal/announcement/index.html'],
342
+ target: '/rule/repeal/announcement',
343
+ },
344
+ {
345
+ title: '已废止规则 - 已废止规则文本',
346
+ source: ['www.szse.cn/www/lawrules/rule/repeal/rules/index.html'],
347
+ target: '/rule/repeal/rules',
348
+ },
349
+ ],
350
+ };
@@ -6,10 +6,10 @@ import { parseDate } from '@/utils/parse-date';
6
6
  import { baseUrl, parseContent } from './utils';
7
7
 
8
8
  export const route: Route = {
9
- path: '/:id/:type?',
9
+ path: '/:id/:type?/:search?',
10
10
  categories: ['multimedia'],
11
11
  example: '/t66y/20/2',
12
- parameters: { id: '分区 id, 可在分区页 URL 中找到', type: '类型 id, 可在分区类型过滤后的 URL 中找到' },
12
+ parameters: { id: '分区 id, 可在分区页 URL 中找到', type: '类型 id, 可在分区类型过滤后的 URL 中找到', search: '主题类型筛选,可在分区主题类型筛选后的 URL 中找到,默认为 `today`' },
13
13
  features: {
14
14
  requireConfig: false,
15
15
  requirePuppeteer: false,
@@ -33,14 +33,35 @@ export const route: Route = {
33
33
 
34
34
  | 技术讨论区 | 新时代的我们 | 达盖尔的旗帜 | 成人文学交流 |
35
35
  | ---------- | ------------ | ------------ | ------------ |
36
- | 7 | 8 | 16 | 20 |`,
36
+ | 7 | 8 | 16 | 20 |
37
+
38
+ **主题过滤**
39
+
40
+ > 因为该类型无法搭配子类型使用,所以使用时 \`type\` 子类型需使用 \`-999\` 占位
41
+
42
+ | 今日主题 | 热门主题 | 精华主题 | 原创主题 | 今日新作 |
43
+ | ------- | ------- | ------- | ------- | ------ |
44
+ | today | hot | digest | 1 | 2 |`,
37
45
  };
38
46
 
47
+ const SEARCH_NAMES = {
48
+ today: '今日主题',
49
+ hot: '热门主题',
50
+ digest: '精华主题',
51
+ 1: '原创主题',
52
+ 2: '今日新作',
53
+ };
54
+
55
+ const DEFAULT_SEARCH_TYPE = 'today';
56
+
39
57
  async function handler(ctx) {
40
- const { id, type } = ctx.req.param();
58
+ const id = ctx.req.param('id');
59
+ const type = (Number.parseInt(ctx.req.param('type')) || -999).toString();
60
+ const isValidType = type !== '-999';
61
+ const search = isValidType ? DEFAULT_SEARCH_TYPE : (ctx.req.param('search') ?? DEFAULT_SEARCH_TYPE);
41
62
 
42
- const url = new URL(`thread0806.php?fid=${id}&search=today`, baseUrl);
43
- type && url.searchParams.set('type', type);
63
+ const url = new URL(`thread0806.php?fid=${id}&search=${search}`, baseUrl);
64
+ isValidType && url.searchParams.set('type', type);
44
65
 
45
66
  const { data: res } = await got(url);
46
67
  const $ = cheerio.load(res);
@@ -80,8 +101,9 @@ async function handler(ctx) {
80
101
  );
81
102
 
82
103
  return {
83
- title: (type ? `[${$('.t .fn b').text()}]` : '') + $('head title').text(),
104
+ title: (isValidType ? `[${$('.t .fn b').text()}] ` : '') + (search ? `[${SEARCH_NAMES[search]}] ` : '') + $('head title').text(),
84
105
  link: url.href,
85
106
  item: out,
107
+ allowEmpty: true,
86
108
  };
87
109
  }
@@ -64,7 +64,7 @@ async function handler(ctx) {
64
64
  method: 'get',
65
65
  url: item.link,
66
66
  });
67
- if (detailResponse.url.startsWith('https://www.taoguba.com.cn/topic/transfer')) {
67
+ if (detailResponse.url?.startsWith('https://www.taoguba.com.cn/topic/transfer')) {
68
68
  item.description = '登录后查看完整文章';
69
69
  return item;
70
70
  }
@@ -51,7 +51,7 @@ async function handler(ctx) {
51
51
  method: 'get',
52
52
  url: item.link,
53
53
  });
54
- if (detailResponse.url.startsWith('https://www.taoguba.com.cn/topic/transfer')) {
54
+ if (detailResponse.url?.startsWith('https://www.taoguba.com.cn/topic/transfer')) {
55
55
  item.description = '登录后查看完整文章';
56
56
  return item;
57
57
  }
@@ -1,8 +1,12 @@
1
1
  import { Route } from '@/types';
2
- import cache from '@/utils/cache';
3
- import parser from '@/utils/rss-parser';
4
2
  import got from '@/utils/got';
5
3
  import { load } from 'cheerio';
4
+ import { parseDate } from '@/utils/parse-date';
5
+ import { art } from '@/utils/render';
6
+ import path from 'node:path';
7
+ import { getCurrentPath } from '@/utils/helpers';
8
+ const __dirname = getCurrentPath(import.meta.url);
9
+
6
10
  const host = 'https://techcrunch.com';
7
11
  export const route: Route = {
8
12
  path: '/news',
@@ -29,33 +33,20 @@ export const route: Route = {
29
33
  };
30
34
 
31
35
  async function handler() {
32
- const rssUrl = `${host}/feed/`;
33
- const feed = await parser.parseURL(rssUrl);
34
- const items = await Promise.all(
35
- feed.items.map((item) =>
36
- cache.tryGet(item.link, async () => {
37
- const url = item.link;
38
- const response = await got({
39
- url,
40
- method: 'get',
41
- });
42
- const html = response.data;
43
- const $ = load(html);
44
- const description = $('#root');
45
- description.find('.article__title').remove();
46
- description.find('.article__byline__meta').remove();
47
- description.find('.mobile-header-nav').remove();
48
- description.find('.desktop-nav').remove();
49
- return {
50
- title: item.title,
51
- pubDate: item.pubDate,
52
- link: item.link,
53
- category: item.categories,
54
- description: description.html(),
55
- };
56
- })
57
- )
58
- );
36
+ const { data } = await got(`${host}/wp-json/wp/v2/posts`);
37
+ const items = data.map((item) => {
38
+ const head = item.yoast_head_json;
39
+ const $ = load(item.content.rendered, null, false);
40
+ return {
41
+ title: item.title.rendered,
42
+ description: art(path.join(__dirname, 'templates/description.art'), {
43
+ head,
44
+ rendered: $.html(),
45
+ }),
46
+ link: item.link,
47
+ pubDate: parseDate(item.date_gmt),
48
+ };
49
+ });
59
50
 
60
51
  return {
61
52
  title: 'TechCrunch',
@@ -0,0 +1,7 @@
1
+ {{ if head.og_image }}
2
+ {{ each head.og_image img }}
3
+ <img src="{{ img.url.split('?')[0] }}">
4
+ {{ /each }}
5
+ <br>
6
+ {{ /if }}
7
+ {{@ rendered }}
@@ -428,7 +428,40 @@ async function handler(ctx) {
428
428
  const background = $node.css('background-image');
429
429
  const backgroundUrl = background && background.match(/url\('(.*)'\)/);
430
430
  const backgroundUrlSrc = backgroundUrl && backgroundUrl[1];
431
- tag_media += backgroundUrlSrc ? `<img src="${backgroundUrlSrc}">` : '';
431
+ const attrs = [`src="${backgroundUrlSrc}"`];
432
+ /*
433
+ * If the width is not in px, it is either a percentage (Link Preview/Instant view)
434
+ * or absent (ditto).
435
+ * Only accept px to prevent images from being invisible or too small.
436
+ */
437
+ let width = 0;
438
+ const widthStr = $node.css('width');
439
+ if (widthStr && widthStr.endsWith('px')) {
440
+ width = Number.parseFloat(widthStr);
441
+ }
442
+ /*
443
+ * Height is present when the message is an album but does not exist in other cases.
444
+ * Ditto, only accept px.
445
+ * !!!NOTE: images in albums may have smaller width and height.
446
+ */
447
+ let height = 0;
448
+ const heightStr = $node.css('height');
449
+ if (heightStr && heightStr.endsWith('px')) {
450
+ height = Number.parseFloat(heightStr);
451
+ }
452
+ /*
453
+ * Only calculate height when needed.
454
+ * The aspect ratio is either a percentage (single image) or absent (Link Preview).
455
+ * Only accept percentage to prevent images from being invisible or distorted.
456
+ */
457
+ const aspectRatioStr = $node.find('.tgme_widget_message_photo').css('padding-top');
458
+ if (height <= 0 && width > 0 && aspectRatioStr && aspectRatioStr.endsWith('%')) {
459
+ height = (Number.parseFloat(aspectRatioStr) / 100) * width;
460
+ }
461
+ // Only set width/height when >32 to avoid invisible images.
462
+ width > 32 && attrs.push(`width="${width}"`);
463
+ height > 32 && attrs.push(`height="${height.toFixed(2).replace('.00', '')}"`);
464
+ tag_media += backgroundUrlSrc ? `<img ${attrs.join(' ')}>` : '';
432
465
  }
433
466
  if (tag_media) {
434
467
  tag_media_all += tag_media;