rsshub 1.0.0-master.af82175 → 1.0.0-master.af87f6b

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 (116) hide show
  1. package/lib/router.js +1 -1
  2. package/lib/v2/2048/index.js +2 -3
  3. package/lib/v2/56kog/class.js +10 -0
  4. package/lib/v2/56kog/maintainer.js +4 -0
  5. package/lib/v2/56kog/radar.js +85 -0
  6. package/lib/v2/56kog/router.js +4 -0
  7. package/lib/v2/56kog/templates/description.art +32 -0
  8. package/lib/v2/56kog/top.js +10 -0
  9. package/lib/v2/56kog/util.js +111 -0
  10. package/lib/v2/bilibili/cache.js +34 -2
  11. package/lib/v2/bilibili/maintainer.js +1 -1
  12. package/lib/v2/bilibili/utils.js +1 -1
  13. package/lib/v2/bilibili/watchlater.js +1 -1
  14. package/lib/v2/boc/radar.js +1 -1
  15. package/lib/v2/bulianglin/bulianglin.js +32 -0
  16. package/lib/v2/bulianglin/maintainer.js +3 -0
  17. package/lib/v2/bulianglin/radar.js +13 -0
  18. package/lib/v2/bulianglin/router.js +3 -0
  19. package/lib/v2/cib/maintainer.js +3 -0
  20. package/lib/v2/cib/radar.js +13 -0
  21. package/lib/v2/cib/router.js +3 -0
  22. package/lib/v2/cib/whpj.js +85 -0
  23. package/lib/v2/cna/web/index.js +1 -1
  24. package/lib/v2/douban/other/list.js +46 -32
  25. package/lib/v2/free/maintainer.js +3 -0
  26. package/lib/v2/free/radar.js +13 -0
  27. package/lib/v2/free/router.js +3 -0
  28. package/lib/v2/free/rss.js +19 -0
  29. package/lib/v2/ft/myft.js +1 -1
  30. package/lib/v2/hicairo/maintainer.js +3 -0
  31. package/lib/v2/hicairo/radar.js +13 -0
  32. package/lib/v2/hicairo/router.js +3 -0
  33. package/lib/v2/hicairo/rss.js +32 -0
  34. package/lib/v2/hitwh/today.js +10 -2
  35. package/lib/v2/howtoforge/maintainer.js +3 -0
  36. package/lib/v2/howtoforge/radar.js +13 -0
  37. package/lib/v2/howtoforge/router.js +3 -0
  38. package/lib/v2/howtoforge/rss.js +32 -0
  39. package/lib/v2/huggingface/daily-papers.js +10 -7
  40. package/lib/v2/indienova/article.js +24 -0
  41. package/lib/v2/indienova/column.js +20 -0
  42. package/lib/v2/indienova/gamedb.js +55 -0
  43. package/lib/v2/indienova/maintainer.js +6 -0
  44. package/lib/v2/indienova/radar.js +37 -0
  45. package/lib/v2/indienova/router.js +6 -0
  46. package/lib/v2/indienova/usergames.js +42 -0
  47. package/lib/v2/indienova/utils.js +43 -0
  48. package/lib/v2/instagram/common-utils.js +1 -1
  49. package/lib/v2/iqnew/radar.js +1 -1
  50. package/lib/v2/jjwxc/author.js +68 -0
  51. package/lib/v2/jjwxc/book.js +106 -0
  52. package/lib/v2/jjwxc/maintainer.js +4 -0
  53. package/lib/v2/jjwxc/radar.js +29 -0
  54. package/lib/v2/jjwxc/router.js +4 -0
  55. package/lib/v2/jjwxc/templates/author.art +28 -0
  56. package/lib/v2/jjwxc/templates/book.art +44 -0
  57. package/lib/v2/jsu/cxzx.js +75 -0
  58. package/lib/v2/jsu/jwc.js +59 -0
  59. package/lib/v2/jsu/maintainer.js +7 -0
  60. package/lib/v2/jsu/math.js +41 -0
  61. package/lib/v2/jsu/radar.js +36 -0
  62. package/lib/v2/jsu/rjxy.js +43 -0
  63. package/lib/v2/jsu/router.js +8 -0
  64. package/lib/v2/jsu/universityindex.js +48 -0
  65. package/lib/v2/jsu/utils/index.js +52 -0
  66. package/lib/v2/kemono/index.js +4 -2
  67. package/lib/v2/lala/maintainer.js +3 -0
  68. package/lib/v2/lala/radar.js +13 -0
  69. package/lib/v2/lala/router.js +3 -0
  70. package/lib/v2/lala/rss.js +32 -0
  71. package/lib/v2/lofter/tag.js +69 -34
  72. package/lib/v2/m4/index.js +82 -0
  73. package/lib/v2/m4/maintainer.js +4 -0
  74. package/lib/v2/m4/radar.js +87 -0
  75. package/lib/v2/m4/router.js +3 -0
  76. package/lib/v2/m4/templates/description.art +21 -0
  77. package/lib/v2/metacritic/index.js +1 -1
  78. package/lib/v2/playpcesor/maintainer.js +3 -0
  79. package/lib/v2/playpcesor/radar.js +13 -0
  80. package/lib/v2/playpcesor/router.js +3 -0
  81. package/lib/v2/playpcesor/rss.js +32 -0
  82. package/lib/v2/pts/index.js +5 -5
  83. package/lib/v2/pwc/maintainer.js +3 -0
  84. package/lib/v2/pwc/radar.js +13 -0
  85. package/lib/v2/pwc/router.js +3 -0
  86. package/lib/v2/pwc/sustainability.js +58 -0
  87. package/lib/v2/qdu/houqin.js +63 -0
  88. package/lib/v2/qdu/maintainer.js +1 -0
  89. package/lib/v2/qdu/radar.js +8 -0
  90. package/lib/v2/qdu/router.js +1 -0
  91. package/lib/v2/remnote/changelog.js +0 -1
  92. package/lib/v2/remnote/maintainer.js +1 -1
  93. package/lib/v2/shisu/maintainer.js +3 -0
  94. package/lib/v2/shisu/news.js +64 -0
  95. package/lib/v2/shisu/radar.js +13 -0
  96. package/lib/v2/shisu/router.js +3 -0
  97. package/lib/v2/shoac/maintainer.js +3 -0
  98. package/lib/v2/shoac/radar.js +13 -0
  99. package/lib/v2/shoac/recent-show.js +72 -0
  100. package/lib/v2/shoac/router.js +3 -0
  101. package/lib/v2/shoac/templates/detail.art +25 -0
  102. package/lib/v2/transcriptforest/index.js +116 -0
  103. package/lib/v2/transcriptforest/maintainer.js +3 -0
  104. package/lib/v2/transcriptforest/radar.js +307 -0
  105. package/lib/v2/transcriptforest/router.js +3 -0
  106. package/lib/v2/transcriptforest/templates/description.art +23 -0
  107. package/lib/v2/u3c3/index.js +21 -7
  108. package/lib/v2/u3c3/maintainer.js +2 -1
  109. package/lib/v2/u3c3/router.js +2 -1
  110. package/lib/v2/u9a9/index.js +13 -13
  111. package/lib/v2/unraid/community-apps.js +35 -0
  112. package/lib/v2/unraid/maintainer.js +3 -0
  113. package/lib/v2/unraid/radar.js +13 -0
  114. package/lib/v2/unraid/router.js +3 -0
  115. package/package.json +11 -11
  116. package/lib/routes/indienova/article.js +0 -53
package/lib/router.js CHANGED
@@ -533,7 +533,7 @@ router.get('/xiaoheihe/discount/:platform?', lazyloadRouteHandler('./routes/xiao
533
533
  router.get('/ebb', lazyloadRouteHandler('./routes/ebb'));
534
534
 
535
535
  // Indienova
536
- router.get('/indienova/:type', lazyloadRouteHandler('./routes/indienova/article'));
536
+ // router.get('/indienova/:type', lazyloadRouteHandler('./routes/indienova/article'));
537
537
 
538
538
  // JPMorgan Chase Institute
539
539
  router.get('/jpmorganchase', lazyloadRouteHandler('./routes/jpmorganchase/research'));
@@ -17,9 +17,8 @@ module.exports = async (ctx) => {
17
17
  },
18
18
  });
19
19
  const $ = cheerio.load(response);
20
- return $('ul li a')
21
- .toArray()
22
- .find((item) => $(item).text() === '最新線路1').attribs.href;
20
+ const targetLink = $('table.group-table tr').eq(1).find('td a').eq(0).attr('href');
21
+ return targetLink;
23
22
  });
24
23
 
25
24
  const currentUrl = `${entranceDomain}/2048/thread.php?fid-${id}.html`;
@@ -0,0 +1,10 @@
1
+ const { rootUrl, fetchItems } = require('./util');
2
+
3
+ module.exports = async (ctx) => {
4
+ const { category = '1_1' } = ctx.params;
5
+ const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
6
+
7
+ const currentUrl = new URL(`class/${category}.html`, rootUrl).href;
8
+
9
+ ctx.state.data = await fetchItems(limit, currentUrl, ctx.cache.tryGet);
10
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ '/class/:category?': ['nczitzk'],
3
+ '/top/:category?': ['nczitzk'],
4
+ };
@@ -0,0 +1,85 @@
1
+ module.exports = {
2
+ '56kog.com': {
3
+ _name: '明月中文网',
4
+ '.': [
5
+ {
6
+ title: '玄幻魔法',
7
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
8
+ source: ['/class/1_1.html'],
9
+ target: '/56kog/class/1_1',
10
+ },
11
+ {
12
+ title: '武侠修真',
13
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
14
+ source: ['/class/2_1.html'],
15
+ target: '/56kog/class/2_1',
16
+ },
17
+ {
18
+ title: '历史军事',
19
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
20
+ source: ['/class/4_1.html'],
21
+ target: '/56kog/class/4_1',
22
+ },
23
+ {
24
+ title: '侦探推理',
25
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
26
+ source: ['/class/5_1.html'],
27
+ target: '/56kog/class/5_1',
28
+ },
29
+ {
30
+ title: '网游动漫',
31
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
32
+ source: ['/class/6_1.html'],
33
+ target: '/56kog/class/6_1',
34
+ },
35
+ {
36
+ title: '恐怖灵异',
37
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
38
+ source: ['/class/8_1.html'],
39
+ target: '/56kog/class/8_1',
40
+ },
41
+ {
42
+ title: '都市言情',
43
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
44
+ source: ['/class/3_1.html'],
45
+ target: '/56kog/class/3_1',
46
+ },
47
+ {
48
+ title: '科幻',
49
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
50
+ source: ['/class/7_1.html'],
51
+ target: '/56kog/class/7_1',
52
+ },
53
+ {
54
+ title: '女生小说',
55
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
56
+ source: ['/class/9_1.html'],
57
+ target: '/56kog/class/9_1',
58
+ },
59
+ {
60
+ title: '其他',
61
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-fen-lei',
62
+ source: ['/class/10_1.html'],
63
+ target: '/56kog/class/10_1',
64
+ },
65
+ {
66
+ title: '周点击榜',
67
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-bang-dan',
68
+ source: ['/top/weekvisit_1.html'],
69
+ target: '/56kog/top/weekvisit',
70
+ },
71
+ {
72
+ title: '总收藏榜',
73
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-bang-dan',
74
+ source: ['/top/goodnum_1.html'],
75
+ target: '/56kog/top/goodnum',
76
+ },
77
+ {
78
+ title: '最新入库',
79
+ docs: 'https://docs.rsshub.app/routes/reading#ming-yue-zhong-wen-wang-bang-dan',
80
+ source: ['/top/postdate_1.html'],
81
+ target: '/56kog/top/postdate',
82
+ },
83
+ ],
84
+ },
85
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = (router) => {
2
+ router.get('/class/:category?', require('./class'));
3
+ router.get('/top/:category?', require('./top'));
4
+ };
@@ -0,0 +1,32 @@
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
+ src="{{ image.src }}">
10
+ </figure>
11
+ {{ /if }}
12
+ {{ /each }}
13
+ {{ /if }}
14
+
15
+ {{ if details }}
16
+ <table>
17
+ <tbody>
18
+ {{ each details detail }}
19
+ <tr>
20
+ <th>{{ detail.label }}</th>
21
+ <td>
22
+ {{ if detail.value?.href && detail.value?.text }}
23
+ <a href="{{ detail.value.href }}">{{ detail.value.text }}</a>
24
+ {{ else }}
25
+ {{ detail.value }}
26
+ {{ /if }}
27
+ </td>
28
+ </tr>
29
+ {{ /each }}
30
+ </tbody>
31
+ </table>
32
+ {{ /if }}
@@ -0,0 +1,10 @@
1
+ const { rootUrl, fetchItems } = require('./util');
2
+
3
+ module.exports = async (ctx) => {
4
+ const { category = 'weekvisit' } = ctx.params;
5
+ const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
6
+
7
+ const currentUrl = new URL(`top/${category.split(/_/)[0]}_1.html`, rootUrl).href;
8
+
9
+ ctx.state.data = await fetchItems(limit, currentUrl, ctx.cache.tryGet);
10
+ };
@@ -0,0 +1,111 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const iconv = require('iconv-lite');
4
+ const timezone = require('@/utils/timezone');
5
+ const { parseDate } = require('@/utils/parse-date');
6
+ const { art } = require('@/utils/render');
7
+ const path = require('path');
8
+
9
+ const rootUrl = 'https://www.56kog.com';
10
+
11
+ const fetchItems = async (limit, currentUrl, tryGet) => {
12
+ const { data: response } = await got(currentUrl, {
13
+ responseType: 'buffer',
14
+ });
15
+
16
+ const $ = cheerio.load(iconv.decode(response, 'gbk'));
17
+
18
+ let items = $('p.line')
19
+ .toArray()
20
+ .map((item) => {
21
+ item = $(item);
22
+
23
+ const a = item.find('a');
24
+
25
+ return {
26
+ title: a.text(),
27
+ link: new URL(a.prop('href'), rootUrl).href,
28
+ author: item.find('span').last().text(),
29
+ };
30
+ });
31
+
32
+ items = await Promise.all(
33
+ items.map((item) =>
34
+ tryGet(item.link, async () => {
35
+ try {
36
+ const { data: detailResponse } = await got(item.link, {
37
+ responseType: 'buffer',
38
+ });
39
+
40
+ const content = cheerio.load(iconv.decode(detailResponse, 'gbk'));
41
+
42
+ const details = content('div.mohe-content p')
43
+ .toArray()
44
+ .map((detail) => {
45
+ detail = content(detail);
46
+ const as = detail.find('a');
47
+
48
+ return {
49
+ label: detail.find('span.c-l-depths').text().split(/:/)[0],
50
+ value:
51
+ as.length === 0
52
+ ? content(
53
+ detail
54
+ .contents()
55
+ .toArray()
56
+ .find((c) => c.nodeType === 3)
57
+ )
58
+ .text()
59
+ .trim()
60
+ : {
61
+ href: new URL(as.first().prop('href'), rootUrl).href,
62
+ text: as.first().text().trim(),
63
+ },
64
+ };
65
+ });
66
+
67
+ const pubDate = details.find((detail) => detail.label === '更新').value;
68
+
69
+ item.title = content('h1').contents().first().text();
70
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
71
+ images: [
72
+ {
73
+ src: new URL(content('a.mohe-imgs img').prop('src'), rootUrl).href,
74
+ alt: item.title,
75
+ },
76
+ ],
77
+ details,
78
+ });
79
+ item.author = details.find((detail) => detail.label === '作者').value;
80
+ item.category = [details.find((detail) => detail.label === '状态').value, details.find((detail) => detail.label === '类型').value.text].filter(Boolean);
81
+ item.guid = `56kog-${item.link.match(/\/(\d+)\.html$/)[1]}#${pubDate}`;
82
+ item.pubDate = timezone(parseDate(pubDate), +8);
83
+ } catch {
84
+ // no-empty
85
+ }
86
+
87
+ return item;
88
+ })
89
+ )
90
+ );
91
+
92
+ const icon = new URL('favicon.ico', rootUrl).href;
93
+
94
+ return {
95
+ item: items.filter((item) => item.description).slice(0, limit),
96
+ title: $('title').text(),
97
+ link: currentUrl,
98
+ description: $('meta[name="description"]').prop('content'),
99
+ language: $('html').prop('lang'),
100
+ icon,
101
+ logo: icon,
102
+ subtitle: $('meta[name="keywords"]').prop('content'),
103
+ author: $('div.uni_footer a').text(),
104
+ allowEmpty: true,
105
+ };
106
+ };
107
+
108
+ module.exports = {
109
+ rootUrl,
110
+ fetchItems,
111
+ };
@@ -203,7 +203,7 @@ module.exports = {
203
203
  return aid;
204
204
  },
205
205
  getArticleDataFromCvid: async (ctx, cvid, uid) => {
206
- const url = `https://www.bilibili.com/read/cv${cvid}`;
206
+ const url = `https://www.bilibili.com/read/cv${cvid}/`;
207
207
  const data = await ctx.cache.tryGet(
208
208
  url,
209
209
  async () =>
@@ -218,7 +218,39 @@ module.exports = {
218
218
  ).data
219
219
  );
220
220
  const $ = cheerio.load(data);
221
- const description = $('#read-article-holder').html();
221
+ let description = $('#read-article-holder').html();
222
+ if (!description) {
223
+ try {
224
+ const newFormatData = JSON.parse(
225
+ $('script:contains("window.__INITIAL_STATE__")')
226
+ .text()
227
+ .match(/window\.__INITIAL_STATE__\s*=\s*(.*?);\(/)[1]
228
+ );
229
+
230
+ if (newFormatData?.readInfo?.opus?.content?.paragraphs) {
231
+ description = '';
232
+ for (const element of newFormatData.readInfo.opus.content.paragraphs) {
233
+ if (element.para_type === 1) {
234
+ for (const text of element.text.nodes) {
235
+ if (text?.word?.words) {
236
+ description += `<p>${text.word.words}</p>`;
237
+ }
238
+ }
239
+ }
240
+ if (element.para_type === 2) {
241
+ for (const image of element.pic.pics) {
242
+ description += `<p ><img src="${image.url}@progressive.webp"></p>`;
243
+ }
244
+ }
245
+ if (element.para_type === 3 && element.line?.pic?.url) {
246
+ description += `<figure><img src="${element.line.pic.url}"></figure>`;
247
+ }
248
+ }
249
+ }
250
+ } catch {
251
+ /* empty */
252
+ }
253
+ }
222
254
  return { url, description };
223
255
  },
224
256
  };
@@ -22,7 +22,7 @@ module.exports = {
22
22
  '/popular/all': ['ziminliu'],
23
23
  '/ranking/:rid?/:day?/:arc_type?/:disableEmbed?': ['DIYgod'],
24
24
  '/readlist/:listid': ['hoilc'],
25
- '/user/article/:uid': ['lengthmin'],
25
+ '/user/article/:uid': ['lengthmin', 'Qixingchen'],
26
26
  '/user/bangumi/:uid/:type?': ['wdssmq'],
27
27
  '/user/channel/:uid/:sid/:disableEmbed?': ['weirongxu'],
28
28
  '/user/coin/:uid/:disableEmbed?': ['DIYgod'],
@@ -3,7 +3,7 @@ const md5 = require('@/utils/md5');
3
3
  const CryptoJS = require('crypto-js');
4
4
 
5
5
  function iframe(aid, page, bvid) {
6
- return `<iframe src="https://player.bilibili.com/player.html?${bvid ? `bvid=${bvid}` : `aid=${aid}`}${
6
+ return `<iframe src="https://www.bilibili.com/blackboard/html5mobileplayer.html?${bvid ? `bvid=${bvid}` : `aid=${aid}`}${
7
7
  page ? `&page=${page}` : ''
8
8
  }&high_quality=1&autoplay=0" width="650" height="477" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`;
9
9
  }
@@ -26,7 +26,7 @@ module.exports = async (ctx) => {
26
26
  const message = response.data.code === -6 ? '对应 uid 的 Bilibili 用户的 Cookie 已过期' : response.data.message;
27
27
  throw new Error(`Error code ${response.data.code}: ${message}`);
28
28
  }
29
- const list = response.data.data.list;
29
+ const list = response.data.data.list || [];
30
30
 
31
31
  const out = list.map((item) => ({
32
32
  title: item.title,
@@ -4,7 +4,7 @@ module.exports = {
4
4
  '.': [
5
5
  {
6
6
  title: '外汇牌价',
7
- docs: 'https://docs.rsshub.app/routes/others#zhong-guo-yin-hang',
7
+ docs: 'https://docs.rsshub.app/routes/other#zhong-guo-yin-hang',
8
8
  source: ['/sourcedb/whpj', '/'],
9
9
  target: '/boc/whpj',
10
10
  },
@@ -0,0 +1,32 @@
1
+ const { parseDate } = require('@/utils/parse-date');
2
+ const got = require('@/utils/got');
3
+ const cheerio = require('cheerio');
4
+
5
+ module.exports = async (ctx) => {
6
+ const url = 'https://bulianglin.com/';
7
+ const response = await got({ method: 'get', url });
8
+ const $ = cheerio.load(response.data);
9
+
10
+ const list = $('div.single-post')
11
+ .map((i, e) => {
12
+ const element = $(e);
13
+ const title = element.find('h2 > a').text();
14
+ const link = element.find('h2 > a').attr('href');
15
+ const description = element.find('p.summary').text();
16
+ const dateraw = element.find('div.text-muted').find('li').eq(1).text();
17
+
18
+ return {
19
+ title,
20
+ description,
21
+ link,
22
+ pubDate: parseDate(dateraw, 'YYYY 年 MM 月 DD 日'),
23
+ };
24
+ })
25
+ .get();
26
+
27
+ ctx.state.data = {
28
+ title: '不良林',
29
+ link: url,
30
+ item: list,
31
+ };
32
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/': ['cnkmmk'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'bulianglin.com': {
3
+ _name: '不良林',
4
+ '.': [
5
+ {
6
+ title: '博客',
7
+ docs: 'https://docs.rsshub.app/routes/blog#bu-liang-lin',
8
+ source: ['/'],
9
+ target: '/bulianglin',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = function (router) {
2
+ router.get('/', require('./bulianglin'));
3
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/whpj/:format?': ['Qixingchen'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'cib.com.cn': {
3
+ _name: '中国兴业银行',
4
+ '.': [
5
+ {
6
+ title: '外汇牌价',
7
+ docs: 'https://docs.rsshub.app/routes/other#zhong-guo-xing-ye-yin-hang',
8
+ source: ['/'],
9
+ target: '/cib/whpj',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/whpj/:format?', require('./whpj'));
3
+ };
@@ -0,0 +1,85 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const https = require('https');
5
+ const crypto = require('crypto');
6
+ const config = require('@/config').value;
7
+
8
+ module.exports = async (ctx) => {
9
+ // fix unsafe legacy renegotiation disabled
10
+ const agent = new https.Agent({
11
+ secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT,
12
+ });
13
+
14
+ const response = await got('https://personalbank.cib.com.cn/pers/main/pubinfo/ifxQuotationQuery.do', { agent: { https: agent } });
15
+ const cookies = response.headers['set-cookie'].map((item) => item.split(';')[0]).join(';');
16
+
17
+ const $ = cheerio.load(response.data);
18
+ let date = $('div.main-body').find('div.labe_text').text();
19
+ date = date.split('\n\t')[1].replace('日期:', '').trim();
20
+ date = date.substring(0, 11) + date.substring(15);
21
+
22
+ const link = 'https://personalbank.cib.com.cn/pers/main/pubinfo/ifxQuotationQuery/list?_search=false&dataSet.rows=80&dataSet.page=1&dataSet.sidx=&dataSet.sord=asc';
23
+ const data = await ctx.cache.tryGet(
24
+ link,
25
+ async () => {
26
+ const detailResponse = await got(link, {
27
+ headers: {
28
+ Cookie: cookies,
29
+ },
30
+ agent: { https: agent },
31
+ });
32
+ return detailResponse.data;
33
+ },
34
+ config.cache.contentExpire,
35
+ false
36
+ );
37
+
38
+ const format = ctx.params.format;
39
+
40
+ ctx.state.data = {
41
+ title: '中国兴业银行外汇牌价',
42
+ link: 'https://personalbank.cib.com.cn/pers/main/pubinfo/ifxQuotationQuery.do',
43
+ item: data.rows.map((item) => {
44
+ const name = `${item.cell[0]} ${item.cell[1]}`;
45
+
46
+ const xhmr = `现汇买入价:${item.cell[3]}`;
47
+
48
+ const xcmr = `现钞买入价:${item.cell[5]}`;
49
+
50
+ const xhmc = `现汇卖出价:${item.cell[4]}`;
51
+
52
+ const xcmc = `现钞卖出价:${item.cell[6]}`;
53
+
54
+ const content = `${xhmr} ${xcmr} ${xhmc} ${xcmc}`;
55
+
56
+ return {
57
+ title: formatTitle(name, xhmr, xcmr, xhmc, xcmc, content, format),
58
+ pubDate: parseDate(date, 'YYYY年MM月DD日 HH:mm:ss'),
59
+ description: content.replaceAll(/\s/g, '<br>'),
60
+ guid: `${item.cell[0]} ${item.cell[1]} ${date}`,
61
+ };
62
+ }),
63
+ };
64
+ };
65
+
66
+ function formatTitle(name, xhmr, xcmr, xhmc, xcmc, content, format) {
67
+ switch (format) {
68
+ case 'short':
69
+ return name;
70
+ case 'xh':
71
+ return `${name} ${xhmr} ${xhmc}`;
72
+ case 'xc':
73
+ return `${name} ${xcmr} ${xcmc}`;
74
+ case 'xhmr':
75
+ return `${name} ${xhmr}`;
76
+ case 'xhmc':
77
+ return `${name} ${xhmc}`;
78
+ case 'xcmr':
79
+ return `${name} ${xcmr}`;
80
+ case 'xcmc':
81
+ return `${name} ${xcmc}`;
82
+ default:
83
+ return `${name} ${content}`;
84
+ }
85
+ }
@@ -20,7 +20,7 @@ module.exports = async (ctx) => {
20
20
  item = $(item);
21
21
  return {
22
22
  title: item.text(),
23
- link: item.parents('a').attr('href'),
23
+ link: new URL(item.parents('a').attr('href'), 'https://www.cna.com.tw').href,
24
24
  pubDate: timezone(parseDate(item.next().text()), +8),
25
25
  };
26
26
  });
@@ -8,40 +8,54 @@ module.exports = async (ctx) => {
8
8
  const routeParams = Object.fromEntries(new URLSearchParams(ctx.params.routeParams));
9
9
  const playable = fallback(undefined, queryToInteger(routeParams.playable), 0);
10
10
  const score = fallback(undefined, queryToInteger(routeParams.score), 0);
11
- const url = `https://m.douban.com/rexxar/api/v2/subject_collection/${type}/items?playable=${playable}`;
12
- const response = await got({
13
- method: 'get',
14
- url,
15
- headers: {
16
- Referer: `https://m.douban.com/subject_collection/${type}`,
17
- },
18
- });
19
- const description = response.data.subject_collection.description;
20
- const items = response.data.subject_collection_items
21
- .filter((item) => {
22
- const rate = item.rating ? item.rating.value : 0;
23
- return rate >= score; // 保留rate大于等于score的项and过滤无评分项
24
- })
25
- .map((item) => {
26
- const title = item.title;
27
- const link = item.url;
28
- const description = art(path.join(__dirname, '../templates/list_description.art'), {
29
- ranking_value: item.ranking_value,
30
- title,
31
- original_title: item.original_title,
32
- rate: item.rating ? item.rating.value : null,
33
- card_subtitle: item.card_subtitle,
34
- description: item.cards ? item.cards[0].content : item.abstract,
35
- cover: item.cover_url || item.cover?.url,
36
- });
37
- return {
38
- title,
39
- link,
40
- description,
41
- };
11
+ let start = 0;
12
+ const count = 50;
13
+ let items = [];
14
+ let title = '';
15
+ let description = '';
16
+ let total = null;
17
+ while (total === null || start < total) {
18
+ const url = `https://m.douban.com/rexxar/api/v2/subject_collection/${type}/items?playable=${playable}&start=${start}&count=${count}`;
19
+ // eslint-disable-next-line no-await-in-loop
20
+ const response = await got({
21
+ method: 'get',
22
+ url,
23
+ headers: {
24
+ Referer: `https://m.douban.com/subject_collection/${type}`,
25
+ },
42
26
  });
27
+ title = response.data.subject_collection.name;
28
+ description = response.data.subject_collection.description;
29
+ total = response.data.total;
30
+ const newItems = response.data.subject_collection_items
31
+ .filter((item) => {
32
+ const rate = item.rating ? item.rating.value : 0;
33
+ return rate >= score; // 保留rate大于等于score的项and过滤无评分项
34
+ })
35
+ .map((item) => {
36
+ const title = item.title;
37
+ const link = item.url;
38
+ const description = art(path.join(__dirname, '../templates/list_description.art'), {
39
+ ranking_value: item.ranking_value,
40
+ title,
41
+ original_title: item.original_title,
42
+ rate: item.rating ? item.rating.value : null,
43
+ card_subtitle: item.card_subtitle,
44
+ description: item.cards ? item.cards[0].content : item.abstract,
45
+ cover: item.cover_url || item.cover?.url,
46
+ });
47
+ return {
48
+ title,
49
+ link,
50
+ description,
51
+ };
52
+ });
53
+ items = [...items, ...newItems];
54
+ start += count;
55
+ }
56
+
43
57
  ctx.state.data = {
44
- title: `豆瓣 - ${response.data.subject_collection.name}`,
58
+ title: `豆瓣 - ${title}`,
45
59
  link: `https://m.douban.com/subject_collection/${type}`,
46
60
  item: items,
47
61
  description,
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/': ['cnkmmk'],
3
+ };