rsshub 1.0.0-master.ec6df29 → 1.0.0-master.ec7b5d6

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 (62) hide show
  1. package/lib/config.js +3 -0
  2. package/lib/v2/1point3acres/maintainer.js +2 -2
  3. package/lib/v2/amazon/maintainer.js +1 -1
  4. package/lib/v2/arcteryx/maintainer.js +3 -3
  5. package/lib/v2/bellroy/maintainer.js +1 -1
  6. package/lib/v2/cste/radar.js +1 -1
  7. package/lib/v2/dahecube/radar.js +40 -4
  8. package/lib/v2/fosshub/radar.js +1 -1
  9. package/lib/v2/gov/maintainer.js +2 -0
  10. package/lib/v2/gov/radar.js +27 -2
  11. package/lib/v2/gov/router.js +2 -0
  12. package/lib/v2/gov/safe/business.js +8 -0
  13. package/lib/v2/gov/safe/complaint.js +8 -0
  14. package/lib/v2/gov/safe/templates/message.art +25 -0
  15. package/lib/v2/gov/safe/util.js +87 -0
  16. package/lib/v2/ifi-audio/maintainer.js +1 -1
  17. package/lib/v2/imiker/jinghua.js +87 -0
  18. package/lib/v2/imiker/maintainer.js +3 -0
  19. package/lib/v2/imiker/radar.js +13 -0
  20. package/lib/v2/imiker/router.js +3 -0
  21. package/lib/v2/imiker/templates/description.art +32 -0
  22. package/lib/v2/inoreader/maintainer.js +1 -1
  23. package/lib/v2/leetcode/maintainer.js +1 -1
  24. package/lib/v2/lightnovel/lightNovel.js +62 -0
  25. package/lib/v2/lightnovel/maintainer.js +3 -0
  26. package/lib/v2/lightnovel/radar.js +13 -0
  27. package/lib/v2/lightnovel/router.js +3 -0
  28. package/lib/v2/magazinelib/maintainer.js +1 -1
  29. package/lib/v2/mihoyo/radar.js +1 -1
  30. package/lib/v2/missav/maintainer.js +3 -0
  31. package/lib/v2/missav/new.js +36 -0
  32. package/lib/v2/missav/radar.js +13 -0
  33. package/lib/v2/missav/router.js +3 -0
  34. package/lib/v2/missav/templates/preview.art +3 -0
  35. package/lib/v2/ncu/radar.js +1 -1
  36. package/lib/v2/nmtv/radar.js +1 -1
  37. package/lib/v2/oo-software/radar.js +1 -1
  38. package/lib/v2/patagonia/maintainer.js +1 -1
  39. package/lib/v2/readhub/daily.js +43 -0
  40. package/lib/v2/readhub/index.js +19 -72
  41. package/lib/v2/readhub/maintainer.js +1 -0
  42. package/lib/v2/readhub/radar.js +6 -0
  43. package/lib/v2/readhub/router.js +1 -0
  44. package/lib/v2/readhub/util.js +69 -0
  45. package/lib/v2/routledge/book-series.js +78 -0
  46. package/lib/v2/routledge/maintainer.js +3 -0
  47. package/lib/v2/routledge/radar.js +13 -0
  48. package/lib/v2/routledge/router.js +3 -0
  49. package/lib/v2/routledge/templates/description.art +7 -0
  50. package/lib/v2/snowpeak/maintainer.js +1 -1
  51. package/lib/v2/sony/maintainer.js +1 -1
  52. package/lib/v2/sse/disclosure.js +4 -3
  53. package/lib/v2/techcrunch/maintainer.js +1 -1
  54. package/lib/v2/theatlantic/maintainer.js +1 -1
  55. package/lib/v2/thepaper/radar.js +2 -2
  56. package/lib/v2/wechat/maintainer.js +1 -1
  57. package/lib/v2/xsijishe/maintainer.js +1 -0
  58. package/lib/v2/xsijishe/radar.js +12 -0
  59. package/lib/v2/xsijishe/rank.js +60 -0
  60. package/lib/v2/xsijishe/router.js +1 -0
  61. package/lib/v2/zagg/maintainer.js +1 -1
  62. package/package.json +2 -2
@@ -0,0 +1,3 @@
1
+ <video controls preload="none" poster="{{ poster }}">
2
+ <source src="{{ video }}" type="{{ type }}">
3
+ </video>
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  'ncu.edu.cn': {
3
3
  _name: '南昌大学',
4
- '.': [
4
+ jwc: [
5
5
  {
6
6
  title: '教务通知',
7
7
  docs: 'https://docs.rsshub.app/routes/university#nan-chang-da-xue',
@@ -6,7 +6,7 @@ module.exports = {
6
6
  title: '点播',
7
7
  docs: 'https://docs.rsshub.app/routes/traditional-media#nei-meng-gu-guang-bo-dian-shi-tai-dian-bo',
8
8
  source: ['/'],
9
- target: (params, url) => `/nmtv/column/${new URL(url).toString.split(/\/folder/).pop()}`,
9
+ target: (params, url) => `/nmtv/column/${url.split(/\/folder/).pop()}`,
10
10
  },
11
11
  ],
12
12
  },
@@ -6,7 +6,7 @@ module.exports = {
6
6
  title: 'Changelog',
7
7
  docs: 'https://docs.rsshub.app/routes/program-update#oo-software-changelog',
8
8
  source: ['/en/changelog'],
9
- target: (params, url) => `/oo-software/changelog/${new URL(url).match(/\/en\/(.*?)\/changelog/)[1]}`,
9
+ target: (params, url) => `/oo-software/changelog/${url.match(/\/en\/(.*?)\/changelog/)[1]}`,
10
10
  },
11
11
  ],
12
12
  },
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/patagonia/new-arrivals/:category': ['NavePnow'],
2
+ '/patagonia/new-arrivals/:category': ['EthanWng97'],
3
3
  };
@@ -0,0 +1,43 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+
4
+ const { rootUrl, processItems } = require('./util');
5
+
6
+ module.exports = async (ctx) => {
7
+ const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 11;
8
+
9
+ const currentUrl = new URL('daily', rootUrl).href;
10
+
11
+ const { data: currentResponse } = await got(currentUrl);
12
+
13
+ const dailyItems = JSON.parse(currentResponse.match(/\{\\"daily\\":(.*?),\\"ts\\":\d+/)[1].replace(/\\"/g, '"'));
14
+
15
+ let items = dailyItems.slice(0, limit).map((item) => ({
16
+ title: item.title,
17
+ link: new URL(`topic/${item.uid}`, rootUrl).href,
18
+ guid: item.uid,
19
+ }));
20
+
21
+ items = await processItems(items, ctx.cache.tryGet);
22
+
23
+ const $ = cheerio.load(currentResponse);
24
+
25
+ const author = $('meta[name="application-name"]').prop('content');
26
+ const subtitle = $('meta[property="og:title"]').prop('content');
27
+ const image = 'https://readhub-oss.nocode.com/static/readhub.png';
28
+ const icon = new URL($('link[rel="apple-touch-icon"]').prop('href'), rootUrl);
29
+
30
+ ctx.state.data = {
31
+ item: items,
32
+ title: `${author} - ${subtitle}`,
33
+ link: currentUrl,
34
+ description: $('meta[name="description"]').prop('content'),
35
+ language: 'zh',
36
+ image,
37
+ icon,
38
+ logo: icon,
39
+ subtitle,
40
+ author,
41
+ allowEmpty: true,
42
+ };
43
+ };
@@ -1,54 +1,29 @@
1
1
  const got = require('@/utils/got');
2
2
  const cheerio = require('cheerio');
3
- const timezone = require('@/utils/timezone');
4
3
  const { parseDate } = require('@/utils/parse-date');
5
- const { art } = require('@/utils/render');
6
4
  const path = require('path');
7
- const dayjs = require('dayjs');
5
+
6
+ const { rootUrl, apiTopicUrl, art, processItems } = require('./util');
8
7
 
9
8
  module.exports = async (ctx) => {
10
- const { category } = ctx.params;
11
- const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
9
+ const { category = '' } = ctx.params;
10
+ const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
12
11
 
13
- const domain = 'readhub.cn';
14
- const rootUrl = `https://${domain}`;
15
- const apiRootUrl = `https://api.${domain}`;
16
12
  const currentUrl = new URL(category ?? '', rootUrl).href;
17
13
 
18
- const isCategory = !category || category === 'daily';
19
-
20
- const formatDate = (date, format) => dayjs(date).format(format);
21
- const toTopicUrl = (id) => new URL(`topic/${id}`, rootUrl).href;
22
-
23
- art.defaults.imports = {
24
- ...art.defaults.imports,
25
- ...{
26
- formatDate,
27
- toTopicUrl,
28
- },
29
- };
30
-
31
14
  const { data: currentResponse } = await got(currentUrl);
32
15
 
33
- const buildId = currentResponse.match(/"buildId":"(\w+)"/)[1];
34
-
35
- const apiUrl = new URL(category ? (category === 'daily' ? `_next/data/${buildId}/daily.json` : 'news/list') : 'topic/list', category === 'daily' ? rootUrl : apiRootUrl).href;
16
+ const type = currentResponse.match(/\[\\"type\\",\\"(\d+)\\",\\"d\\"\]/)?.[1] ?? '1';
36
17
 
37
- const { data: response } = await got(apiUrl, {
18
+ const { data: response } = await got(apiTopicUrl, {
38
19
  searchParams: {
39
- ...(isCategory
40
- ? {}
41
- : {
42
- type: currentResponse.match(/"query":\{"type":"(\d+)"\}/)[1],
43
- }),
44
- ...{
45
- page: 1,
46
- size: limit,
47
- },
20
+ type,
21
+ page: 1,
22
+ size: limit,
48
23
  },
49
24
  });
50
25
 
51
- let items = (response.data?.items ?? response.pageProps.daily).slice(0, limit).map((item) => ({
26
+ let items = response.data.items.slice(0, limit).map((item) => ({
52
27
  title: item.title,
53
28
  link: item.url ?? new URL(`topic/${item.uid}`, rootUrl).href,
54
29
  description: art(path.join(__dirname, 'templates/description.art'), {
@@ -57,55 +32,27 @@ module.exports = async (ctx) => {
57
32
  timeline: item.timeline,
58
33
  }),
59
34
  author: item.siteNameDisplay,
60
- category: item.tagList?.map((c) => c.name) ?? [],
61
- guid: isCategory ? item.uid : `readhub-${item.guid}`,
62
- pubDate: timezone(parseDate(item.publishDate), +8),
35
+ category: [...(item.entityList.map((c) => c.name) ?? []), ...(item.tagList.map((c) => c.name) ?? [])],
36
+ guid: item.uid,
37
+ pubDate: parseDate(item.publishDate),
63
38
  }));
64
39
 
65
- if (isCategory) {
66
- items = await Promise.all(
67
- items.map((item) =>
68
- ctx.cache.tryGet(`readhub-${item.guid}`, async () => {
69
- const { data: detailResponse } = await got(new URL(`_next/data/${buildId}/topic/${item.guid}.json`, rootUrl).href);
70
-
71
- const data = detailResponse.pageProps.topic;
72
-
73
- item.title = data.title;
74
- item.link = data.url ?? new URL(`topic/${data.uid}`, rootUrl).href;
75
- item.description = art(path.join(__dirname, 'templates/description.art'), {
76
- description: data.summary,
77
- news: data.newsAggList,
78
- timeline: data.timeline,
79
- });
80
- item.author = data.entityList.map((a) => a.name).join('/');
81
- item.category = data.tagList.map((c) => c.name);
82
- item.guid = `readhub-${data.uid}`;
83
- item.pubDate = timezone(parseDate(data.publishDate), +8);
84
-
85
- return item;
86
- })
87
- )
88
- );
89
- }
40
+ items = await processItems(items, ctx.cache.tryGet);
90
41
 
91
42
  const $ = cheerio.load(currentResponse);
92
43
 
93
44
  const author = $('meta[property="og:site_name"]').prop('content');
94
- const subtitle = $(
95
- $('nav div a')
96
- .toArray()
97
- .filter((a) => /style_active.*/.test($(a).prop('class')))
98
- .pop()
99
- ).text();
100
- const icon = new URL($('link[rel="apple-touch-icon"]').prop('href'), rootUrl).href;
45
+ const subtitle = $(`a[data-path="/${category}"]`).text();
46
+ const image = $('link[rel="preload"][as="image"]').prop('href');
47
+ const icon = $('meta[property="og:image"]').prop('content');
101
48
 
102
49
  ctx.state.data = {
103
50
  item: items,
104
51
  title: `${author} - ${subtitle}`,
105
52
  link: currentUrl,
106
53
  description: $('meta[property="og:description"]').prop('content'),
107
- language: $('html').prop('lang'),
108
- image: $('meta[property="og:image"]').prop('content'),
54
+ language: 'zh',
55
+ image,
109
56
  icon,
110
57
  logo: icon,
111
58
  subtitle,
@@ -1,3 +1,4 @@
1
1
  module.exports = {
2
+ '/daily': ['nczitzk'],
2
3
  '/:category?': ['WhiteWorld', 'nczitzk', 'Fatpandac'],
3
4
  };
@@ -12,6 +12,12 @@ module.exports = {
12
12
  return `/readhub${category ? `/${category}` : ''}`;
13
13
  },
14
14
  },
15
+ {
16
+ title: '每日早报',
17
+ docs: 'https://docs.rsshub.app/routes/new-media#readhub-mei-ri-zao-bao',
18
+ source: ['/daily'],
19
+ target: '/readhub/daily',
20
+ },
15
21
  ],
16
22
  },
17
23
  };
@@ -1,3 +1,4 @@
1
1
  module.exports = (router) => {
2
+ router.get('/daily', require('./daily'));
2
3
  router.get('/:category?', require('./'));
3
4
  };
@@ -0,0 +1,69 @@
1
+ const got = require('@/utils/got');
2
+ const { parseDate } = require('@/utils/parse-date');
3
+ const { art } = require('@/utils/render');
4
+ const path = require('path');
5
+ const dayjs = require('dayjs');
6
+
7
+ const domain = 'readhub.cn';
8
+ const rootUrl = `https://${domain}`;
9
+ const apiRootUrl = `https://api.${domain}`;
10
+ const apiTopicUrl = new URL('topic/list', apiRootUrl).href;
11
+
12
+ const formatDate = (date, format) => dayjs(date).format(format);
13
+ const toTopicUrl = (id) => new URL(`topic/${id}`, rootUrl).href;
14
+
15
+ art.defaults.imports = {
16
+ ...art.defaults.imports,
17
+ ...{
18
+ formatDate,
19
+ toTopicUrl,
20
+ },
21
+ };
22
+
23
+ /**
24
+ * Process items asynchronously.
25
+ *
26
+ * @param {Array<Object>} items - The array of items to process.
27
+ * @param {function} tryGet - The tryGet function that handles the retrieval process.
28
+ * @returns {Promise<Array<Object>>} Returns a Promise that resolves to an array of processed items.
29
+ */
30
+ const processItems = async (items, tryGet) =>
31
+ await Promise.all(
32
+ items.map((item) =>
33
+ tryGet(item.link, async () => {
34
+ try {
35
+ if (!item.link.startsWith(rootUrl)) {
36
+ throw Error(`"${item.link}" is an external URL`);
37
+ }
38
+
39
+ const { data: detailResponse } = await got(item.link);
40
+
41
+ const data = JSON.parse(detailResponse.match(/\{\\"topic\\":(.*?)\}\]\\n"\]\)<\/script>/)[1].replace(/\\"/g, '"'));
42
+
43
+ item.title = data.title;
44
+ item.link = data.url ?? new URL(`topic/${data.uid}`, rootUrl).href;
45
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
46
+ description: data.summary,
47
+ news: data.newsAggList,
48
+ timeline: data.timeline,
49
+ });
50
+ item.author = data.siteNameDisplay;
51
+ item.category = [...(data.entityList.map((c) => c.name) ?? []), ...(data.tagList.map((c) => c.name) ?? [])];
52
+ item.guid = `readhub-${data.uid}`;
53
+ item.pubDate = parseDate(data.publishDate.replace(/\s/g, ''));
54
+ } catch (e) {
55
+ item.guid = `readhub-${item.guid}`;
56
+ }
57
+
58
+ return item;
59
+ })
60
+ )
61
+ );
62
+
63
+ module.exports = {
64
+ rootUrl,
65
+ apiRootUrl,
66
+ apiTopicUrl,
67
+ art,
68
+ processItems,
69
+ };
@@ -0,0 +1,78 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const { parseDate } = require('@/utils/parse-date');
4
+ const { art } = require('@/utils/render');
5
+ const { join } = require('path');
6
+
7
+ module.exports = async (ctx) => {
8
+ const { bookName, bookId } = ctx.params;
9
+ const baseUrl = 'https://www.routledge.com';
10
+ const pageUrl = `${baseUrl}/${bookName}/book-series/${bookId}`;
11
+ const { data: response } = await got(pageUrl, {
12
+ headers: {
13
+ accept: 'text/html, */*; q=0.01',
14
+ },
15
+ searchParams: {
16
+ publishedFilter: 'alltitles',
17
+ pd: 'published,forthcoming',
18
+ pg: 1,
19
+ pp: 12,
20
+ so: 'pub',
21
+ view: 'list',
22
+ },
23
+ });
24
+ const $ = cheerio.load(response);
25
+
26
+ const list = $('.row.book')
27
+ .toArray()
28
+ .map((item) => {
29
+ item = $(item);
30
+ const title = item.find('h3 a');
31
+ const description = item.find('p.description');
32
+ const meta = item.find('p.description').prev().text().split('\n');
33
+ return {
34
+ title: title.text(),
35
+ link: title.attr('href'),
36
+ description: description.text(),
37
+ pubDate: parseDate(meta.pop().trim(), 'MMMM DD, YYYY'),
38
+ author: meta
39
+ .map((i) => i.trim())
40
+ .filter((i) => i)
41
+ .join(', '),
42
+ };
43
+ });
44
+
45
+ const items = await Promise.all(
46
+ list.map((item) =>
47
+ ctx.cache.tryGet(item.link, async () => {
48
+ const { data } = await got(item.link);
49
+ const $ = cheerio.load(data);
50
+ const isbn = $('meta[property="books:isbn"]').attr('content');
51
+ const { data: image } = await got('https://productimages.routledge.com', {
52
+ searchParams: {
53
+ isbn,
54
+ size: 'amazon',
55
+ ext: 'jpg',
56
+ },
57
+ });
58
+
59
+ const description = $('.sticky-div');
60
+ description.find('button.accordion-button').contents().unwrap();
61
+ description.find('.fa-shopping-cart').parent().parent().remove();
62
+
63
+ item.description = art(join(__dirname, 'templates/description.art'), {
64
+ image,
65
+ description: description.html(),
66
+ });
67
+ return item;
68
+ })
69
+ )
70
+ );
71
+
72
+ ctx.state.data = {
73
+ title: $('head title').text(),
74
+ description: $('head meta[name="description"]').attr('content'),
75
+ link: pageUrl,
76
+ item: items,
77
+ };
78
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ '/:bookName/book-series/:bookId': ['TonyRL'],
3
+ };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ 'routledge.com': {
3
+ _name: 'Routledge',
4
+ '.': [
5
+ {
6
+ title: 'Book Series',
7
+ docs: 'https://docs.rsshub.app/routes/journals#routledge',
8
+ source: ['/:bookName/book-series/:bookId'],
9
+ target: '/routledge/:bookName/book-series/:bookId',
10
+ },
11
+ ],
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = (router) => {
2
+ router.get('/:bookName/book-series/:bookId', require('./book-series'));
3
+ };
@@ -0,0 +1,7 @@
1
+ {{ if image }}
2
+ <img src="{{ image }}"><br>
3
+ {{ /if }}
4
+
5
+ {{ if description }}
6
+ {{@ description }}
7
+ {{ /if }}
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/us/new-arrivals': ['NavePnow'],
2
+ '/us/new-arrivals': ['EthanWng97'],
3
3
  };
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/downloads/:productType/:productId': ['NavePnow'],
2
+ '/downloads/:productType/:productId': ['EthanWng97'],
3
3
  };
@@ -3,7 +3,6 @@ const { parseDate } = require('@/utils/parse-date');
3
3
 
4
4
  module.exports = async (ctx) => {
5
5
  const query = ctx.params.query ?? ''; // beginDate=2018-08-18&endDate=2020-09-01&productId=600696
6
- const host = 'https://www.sse.com.cn';
7
6
  const queries = query.split('&').reduce((acc, cur) => {
8
7
  const [key, value] = cur.split('=');
9
8
  acc[key] = value;
@@ -30,11 +29,13 @@ module.exports = async (ctx) => {
30
29
  },
31
30
  });
32
31
 
32
+ const pdfHost = 'https://static.sse.com.cn';
33
+
33
34
  const items = response.data.result.map((item) => ({
34
35
  title: item.TITLE,
35
- description: `${host}${item.URL}`,
36
+ description: `${pdfHost}${item.URL}`,
36
37
  pubDate: parseDate(item.ADDDATE),
37
- link: `${host}${item.URL}`,
38
+ link: `${pdfHost}${item.URL}`,
38
39
  author: item.SECURITY_NAME,
39
40
  }));
40
41
 
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/news': ['NavePnow'],
2
+ '/news': ['EthanWng97'],
3
3
  };
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/:category': ['NavePnow'],
2
+ '/:category': ['EthanWng97'],
3
3
  };
@@ -18,13 +18,13 @@ module.exports = {
18
18
  title: '频道',
19
19
  docs: 'https://docs.rsshub.app/routes/traditional-media#peng-pai-xin-wen-pin-dao',
20
20
  source: ['/'],
21
- target: (params, url) => `/thepaper/channel/${new URL(url).search(/channel_(\d+)/)}`,
21
+ target: (params, url) => `/thepaper/channel/${url.match(/channel_(\d+)/)?.[1]}`,
22
22
  },
23
23
  {
24
24
  title: '栏目',
25
25
  docs: 'https://docs.rsshub.app/routes/traditional-media#peng-pai-xin-wen-lie-biao',
26
26
  source: ['/'],
27
- target: (params, url) => `/thepaper/list/${new URL(url).search(/list_(\d+)/)}`,
27
+ target: (params, url) => `/thepaper/list/${url.search(/list_(\d+)/)?.[1]}`,
28
28
  },
29
29
  {
30
30
  title: '澎湃美数组作品集',
@@ -7,7 +7,7 @@ module.exports = {
7
7
  '/feeds': ['tylinux'],
8
8
  '/mp/homepage/:biz/:hid/:cid?': ['MisteryMonster'],
9
9
  '/mp/msgalbum/:biz/:aid': ['MisteryMonster'],
10
- '/sogou/:id': ['NavePnow'],
10
+ '/sogou/:id': ['EthanWng97'],
11
11
  '/tgchannel/:id/:mpName?/:searchQueryType?': ['LogicJake', 'Rongronggg9'],
12
12
  '/uread/:userid': ['kt286'],
13
13
  '/wechat2rss/:id': ['TonyRL'],
@@ -1,3 +1,4 @@
1
1
  module.exports = {
2
2
  '/forum/:fid': ['akynazh'],
3
+ '/rank/:type': ['akynazh'],
3
4
  };
@@ -14,6 +14,18 @@ module.exports = {
14
14
  }
15
15
  },
16
16
  },
17
+ {
18
+ title: '周排行榜',
19
+ docs: 'https://docs.rsshub.app/routes/bbs#si-ji-she',
20
+ source: ['/*'],
21
+ target: '/xsijishe/rank/weekly',
22
+ },
23
+ {
24
+ title: '月排行榜',
25
+ docs: 'https://docs.rsshub.app/routes/bbs#si-ji-she',
26
+ source: ['/*'],
27
+ target: '/xsijishe/rank/monthly',
28
+ },
17
29
  ],
18
30
  },
19
31
  };
@@ -0,0 +1,60 @@
1
+ const got = require('@/utils/got');
2
+ const cheerio = require('cheerio');
3
+ const baseUrl = 'https://xsijishe.com';
4
+
5
+ module.exports = async (ctx) => {
6
+ const rankType = ctx.params.type;
7
+ let title;
8
+ let rankId;
9
+ if (rankType === 'weekly') {
10
+ title = '司机社综合周排行榜';
11
+ rankId = 'nex_recons_demens';
12
+ } else if (rankType === 'monthly') {
13
+ title = '司机社综合月排行榜';
14
+ rankId = 'nex_recons_demens1';
15
+ } else {
16
+ throw Error('Invalid rank type');
17
+ }
18
+ const url = `${baseUrl}/portal.php`;
19
+ const resp = await got(url);
20
+ const $ = cheerio.load(resp.data);
21
+ let items = $(`#${rankId} dd`)
22
+ .toArray()
23
+ .map((item) => {
24
+ item = $(item);
25
+ const title = item.find('h5').text().trim();
26
+ const link = item.find('a').attr('href');
27
+ return {
28
+ title,
29
+ link: `${baseUrl}/${link}`,
30
+ };
31
+ });
32
+ items = await Promise.all(
33
+ items.map((item) =>
34
+ ctx.cache.tryGet(item.link, async () => {
35
+ const resp = await got(item.link);
36
+ const $ = cheerio.load(resp.data);
37
+ const firstViewBox = $('.t_f').first();
38
+
39
+ firstViewBox.find('img').each((_, img) => {
40
+ img = $(img);
41
+ if (img.attr('zoomfile')) {
42
+ img.attr('src', img.attr('zoomfile'));
43
+ img.removeAttr('zoomfile');
44
+ img.removeAttr('file');
45
+ }
46
+ img.removeAttr('onmouseover');
47
+ });
48
+
49
+ item.description = firstViewBox.html();
50
+ return item;
51
+ })
52
+ )
53
+ );
54
+ ctx.state.data = {
55
+ title,
56
+ link: url,
57
+ description: title,
58
+ item: items,
59
+ };
60
+ };
@@ -1,3 +1,4 @@
1
1
  module.exports = function (router) {
2
2
  router.get('/forum/:fid', require('./forum'));
3
+ router.get('/rank/:type', require('./rank'));
3
4
  };
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- '/new-arrivals/:query?': ['NavePnow'],
2
+ '/new-arrivals/:query?': ['EthanWng97'],
3
3
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsshub",
3
- "version": "1.0.0-master.ec6df29",
3
+ "version": "1.0.0-master.ec7b5d6",
4
4
  "description": "Make RSS Great Again!",
5
5
  "keywords": [
6
6
  "RSS"
@@ -107,7 +107,7 @@
107
107
  "lru-cache": "10.1.0",
108
108
  "lz-string": "1.5.0",
109
109
  "mailparser": "3.6.5",
110
- "markdown-it": "13.0.2",
110
+ "markdown-it": "14.0.0",
111
111
  "module-alias": "2.2.3",
112
112
  "notion-to-md": "3.1.1",
113
113
  "oauth-1.0a": "2.2.6",