rsshub 1.0.0-master.f10693f → 1.0.0-master.f107701

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 (134) hide show
  1. package/lib/middleware/anti-hotlink.ts +1 -1
  2. package/lib/routes/4ksj/forum.ts +54 -20
  3. package/lib/routes/500px/tribe-set.ts +3 -2
  4. package/lib/routes/51cto/recommend.ts +45 -7
  5. package/lib/routes/academia/namespace.ts +1 -1
  6. package/lib/routes/anime1/anime.ts +63 -0
  7. package/lib/routes/anime1/namespace.ts +6 -0
  8. package/lib/routes/anime1/search.ts +57 -0
  9. package/lib/routes/apple/podcast.ts +1 -1
  10. package/lib/routes/asus/bios.ts +88 -21
  11. package/lib/routes/asus/templates/bios.art +13 -6
  12. package/lib/routes/behance/user.ts +14 -3
  13. package/lib/routes/beijingprice/index.ts +12 -12
  14. package/lib/routes/bilibili/bangumi.ts +3 -2
  15. package/lib/routes/bilibili/followings-dynamic.ts +3 -1
  16. package/lib/routes/bilibili/readlist.ts +3 -2
  17. package/lib/routes/bjp/apod.ts +4 -2
  18. package/lib/routes/bupt/jwc.ts +1 -1
  19. package/lib/routes/caixin/latest.ts +3 -2
  20. package/lib/routes/changba/user.ts +6 -5
  21. package/lib/routes/chikubi/category.ts +41 -0
  22. package/lib/routes/chikubi/index.ts +41 -50
  23. package/lib/routes/chikubi/namespace.ts +9 -0
  24. package/lib/routes/chikubi/navigation.ts +66 -0
  25. package/lib/routes/chikubi/nipple-video-category.ts +49 -0
  26. package/lib/routes/chikubi/nipple-video-maker.ts +49 -0
  27. package/lib/routes/chikubi/search.ts +39 -0
  28. package/lib/routes/chikubi/tag.ts +41 -0
  29. package/lib/routes/chikubi/utils.ts +76 -23
  30. package/lib/routes/cls/subject.ts +153 -0
  31. package/lib/routes/cls/templates/description.art +21 -0
  32. package/lib/routes/deepin/thread.ts +102 -0
  33. package/lib/routes/deeplearning/thebatch.ts +30 -18
  34. package/lib/routes/devolverdigital/blog.ts +1 -1
  35. package/lib/routes/devtrium/posts.ts +1 -1
  36. package/lib/routes/dockerhub/build.ts +1 -1
  37. package/lib/routes/dockerhub/utils.ts +4 -3
  38. package/lib/routes/dykszx/namespace.ts +8 -0
  39. package/lib/routes/dykszx/news.ts +88 -0
  40. package/lib/routes/eagle/blog.ts +13 -2
  41. package/lib/routes/economist/espresso.ts +3 -2
  42. package/lib/routes/economist/full.ts +3 -2
  43. package/lib/routes/epicgames/index.ts +1 -1
  44. package/lib/routes/espn/namespace.ts +6 -0
  45. package/lib/routes/espn/news.ts +120 -0
  46. package/lib/routes/espn/templates/media.art +19 -0
  47. package/lib/routes/follow/profile.ts +20 -8
  48. package/lib/routes/follow/types.ts +45 -15
  49. package/lib/routes/gamer/ani/anime.ts +10 -3
  50. package/lib/routes/gamer/ani/new-anime.ts +4 -3
  51. package/lib/routes/gamer/gnn-index.ts +31 -11
  52. package/lib/routes/gamer/hot.ts +4 -3
  53. package/lib/routes/gq/news.ts +3 -2
  54. package/lib/routes/hackernews/index.ts +16 -5
  55. package/lib/routes/hpoi/all.ts +14 -4
  56. package/lib/routes/hpoi/character.ts +15 -4
  57. package/lib/routes/hpoi/info.ts +11 -6
  58. package/lib/routes/hpoi/user.ts +16 -4
  59. package/lib/routes/hpoi/utils.ts +36 -3
  60. package/lib/routes/hpoi/work.ts +15 -4
  61. package/lib/routes/imhcg/blog.ts +1 -1
  62. package/lib/routes/jianshu/collection.ts +3 -2
  63. package/lib/routes/jianshu/home.ts +3 -2
  64. package/lib/routes/jianshu/user.ts +3 -2
  65. package/lib/routes/jike/topic.ts +10 -3
  66. package/lib/routes/jike/user.ts +3 -2
  67. package/lib/routes/lemmy/index.ts +30 -3
  68. package/lib/routes/lemmy/namespace.ts +1 -0
  69. package/lib/routes/mastodon/account-id.ts +26 -3
  70. package/lib/routes/mastodon/acct.ts +11 -1
  71. package/lib/routes/mastodon/timeline-local.ts +11 -1
  72. package/lib/routes/mastodon/timeline-remote.ts +11 -1
  73. package/lib/routes/misskey/featured-notes.ts +3 -2
  74. package/lib/routes/misskey/user-timeline.ts +3 -2
  75. package/lib/routes/natgeo/dailyphoto.ts +5 -4
  76. package/lib/routes/natgeo/dailyselection.ts +18 -3
  77. package/lib/routes/ncku/csie.ts +79 -0
  78. package/lib/routes/ncku/namespace.ts +6 -0
  79. package/lib/routes/newyorker/news.ts +5 -4
  80. package/lib/routes/nhk/news.ts +32 -15
  81. package/lib/routes/nicovideo/namespace.ts +7 -0
  82. package/lib/routes/nicovideo/templates/video.art +7 -0
  83. package/lib/routes/nicovideo/types.ts +54 -0
  84. package/lib/routes/nicovideo/utils.ts +37 -0
  85. package/lib/routes/nicovideo/video.ts +47 -0
  86. package/lib/routes/nytimes/book.ts +14 -17
  87. package/lib/routes/nytimes/index.ts +16 -9
  88. package/lib/routes/obsidian/namespace.ts +6 -0
  89. package/lib/routes/obsidian/publish.ts +83 -0
  90. package/lib/routes/obsidian/utils.ts +8 -0
  91. package/lib/routes/pixiv/ranking.ts +1 -0
  92. package/lib/routes/pku/bbs/hot.ts +1 -1
  93. package/lib/routes/pornhub/pornstar.ts +61 -12
  94. package/lib/routes/qidian/namespace.ts +1 -1
  95. package/lib/routes/reuters/common.ts +54 -1
  96. package/lib/routes/sdu/cs/yjsgz.ts +85 -0
  97. package/lib/routes/sdu/gjsw.ts +80 -0
  98. package/lib/routes/sdu/qd/xszxqd.ts +98 -0
  99. package/lib/routes/sdu/qd/xyb.ts +82 -0
  100. package/lib/routes/sdu/ygb.ts +90 -0
  101. package/lib/routes/smzdm/product.ts +2 -3
  102. package/lib/routes/solidot/main.ts +28 -12
  103. package/lib/routes/sustainabilitymag/namespace.ts +1 -1
  104. package/lib/routes/swjtu/scai/bks.ts +3 -7
  105. package/lib/routes/the/index.ts +3 -1
  106. package/lib/routes/twitch/video.ts +12 -4
  107. package/lib/routes/twitter/api/web-api/login.ts +10 -3
  108. package/lib/routes/twitter/api/web-api/utils.ts +79 -33
  109. package/lib/routes/v2ex/topics.ts +1 -0
  110. package/lib/routes/vimeo/category.ts +4 -3
  111. package/lib/routes/vimeo/usr-videos.ts +3 -2
  112. package/lib/routes/voronoiapp/author.ts +41 -0
  113. package/lib/routes/voronoiapp/common.ts +247 -0
  114. package/lib/routes/voronoiapp/editors-pick.ts +28 -0
  115. package/lib/routes/voronoiapp/home.ts +29 -0
  116. package/lib/routes/voronoiapp/latest.ts +28 -0
  117. package/lib/routes/voronoiapp/namespace.ts +6 -0
  118. package/lib/routes/voronoiapp/popular.ts +49 -0
  119. package/lib/routes/voronoiapp/search.ts +33 -0
  120. package/lib/routes/voronoiapp/types.d.ts +78 -0
  121. package/lib/routes/weibo/user.ts +1 -1
  122. package/lib/routes/whu/cs.ts +11 -3
  123. package/lib/routes/whu/gs/index.ts +2 -1
  124. package/lib/routes/whu/news.ts +27 -2
  125. package/lib/routes/xiaohongshu/user.ts +3 -1
  126. package/lib/routes/yilinzazhi/index.ts +58 -0
  127. package/lib/routes/yilinzazhi/latest.ts +103 -0
  128. package/lib/routes/yilinzazhi/namespace.ts +8 -0
  129. package/lib/routes/youtube/playlist.ts +3 -2
  130. package/lib/utils/request-rewriter/fetch.ts +1 -1
  131. package/package.json +18 -18
  132. package/lib/routes-deprecated/anime1/anime.js +0 -25
  133. package/lib/routes-deprecated/anime1/search.js +0 -25
  134. package/lib/routes-deprecated/dykszx/news.js +0 -60
@@ -17,7 +17,7 @@ const matchPath = (path: string, paths: string[]) => {
17
17
  return false;
18
18
  };
19
19
 
20
- // return ture if the path needs to be processed
20
+ // return true if the path needs to be processed
21
21
  const filterPath = (path: string) => {
22
22
  const include = config.hotlink.includePaths;
23
23
  const exclude = config.hotlink.excludePaths;
@@ -3,13 +3,13 @@ import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
5
5
  import cache from '@/utils/cache';
6
- import got from '@/utils/got';
6
+ import ofetch from '@/utils/ofetch';
7
7
  import { load } from 'cheerio';
8
8
  import timezone from '@/utils/timezone';
9
9
  import { parseDate } from '@/utils/parse-date';
10
10
  import { art } from '@/utils/render';
11
11
  import path from 'node:path';
12
- import iconv from 'iconv-lite';
12
+ import md5 from '@/utils/md5';
13
13
 
14
14
  export const route: Route = {
15
15
  path: '/:id?',
@@ -27,6 +27,16 @@ export const route: Route = {
27
27
  categories: ['multimedia'],
28
28
  };
29
29
 
30
+ function stringtoHex(acSTR) {
31
+ let val = '';
32
+ for (let i = 0; i <= acSTR.length - 1; i++) {
33
+ const str = acSTR.charAt(i);
34
+ const code = str.codePointAt();
35
+ val += code;
36
+ }
37
+ return val;
38
+ }
39
+
30
40
  async function handler(ctx) {
31
41
  const { id = '4k-uhd-1' } = ctx.req.param();
32
42
  const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
@@ -34,11 +44,13 @@ async function handler(ctx) {
34
44
  const rootUrl = 'https://www.4ksj.com';
35
45
  const currentUrl = new URL(`${id}.html`, rootUrl).href;
36
46
 
37
- const { data: response } = await got(currentUrl, {
38
- responseType: 'buffer',
47
+ const response = await ofetch(currentUrl, {
48
+ responseType: 'arrayBuffer',
39
49
  });
40
50
 
41
- const $ = load(iconv.decode(response, 'gbk'));
51
+ const decoder = new TextDecoder('gbk');
52
+
53
+ const $ = load(decoder.decode(response));
42
54
 
43
55
  const language = 'zh';
44
56
  const image = $('div.nexlogo img').prop('src');
@@ -54,14 +66,42 @@ async function handler(ctx) {
54
66
  };
55
67
  });
56
68
 
69
+ const getCookie = () =>
70
+ cache.tryGet('4ksj:cookie', async () => {
71
+ const response = await ofetch(items[0].link);
72
+ const $ = load(response);
73
+ const scriptPath = $('script').attr('src')!;
74
+ const scriptUrl = new URL(scriptPath, rootUrl).href;
75
+
76
+ const scriptResponse = await ofetch(scriptUrl);
77
+ const key = scriptResponse.match(/{var key="(.*?)"/)?.[1];
78
+ const value = scriptResponse.match(/",value="(.*?)"/)?.[1];
79
+ const getPath = scriptResponse.match(/\.get\("(.*?&key=)"/)?.[1];
80
+
81
+ if (!key || !value || !getPath) {
82
+ throw new Error('Failed to get cookie');
83
+ }
84
+
85
+ const cookieResponse = await ofetch.raw(`${rootUrl}${getPath}${key}&value=${md5(stringtoHex(value))}`);
86
+ return cookieResponse.headers
87
+ .getSetCookie()
88
+ .map((c) => c.split(';')[0])
89
+ .join('; ');
90
+ });
91
+
92
+ const cookie = await getCookie();
93
+
57
94
  items = await Promise.all(
58
95
  items.map((item) =>
59
96
  cache.tryGet(item.link, async () => {
60
- const { data: detailResponse } = await got(item.link, {
61
- responseType: 'buffer',
97
+ const detailResponse = await ofetch(item.link, {
98
+ responseType: 'arrayBuffer',
99
+ headers: {
100
+ Cookie: cookie as string,
101
+ },
62
102
  });
63
103
 
64
- const $$ = load(iconv.decode(detailResponse, 'gbk'));
104
+ const $$ = load(decoder.decode(detailResponse));
65
105
 
66
106
  $$('div.nex_drama_intros em').first().remove();
67
107
  $$('strong font').each((_, el) => {
@@ -86,14 +126,8 @@ async function handler(ctx) {
86
126
  const value = li.find('span').length === 0 ? li.contents().last().text().trim() : li.find('span').text().trim();
87
127
 
88
128
  return { [key]: value };
89
- })
90
- .reduce(
91
- (obj, item) => ({
92
- ...obj,
93
- ...item,
94
- }),
95
- {}
96
- );
129
+ });
130
+ const mergedDetails = Object.assign({}, ...details);
97
131
 
98
132
  const links =
99
133
  $$('td.t_f ignore_js_op').length === 0
@@ -154,17 +188,17 @@ async function handler(ctx) {
154
188
  ]
155
189
  : undefined,
156
190
  title,
157
- keys: Object.keys(details),
158
- details,
191
+ keys: Object.keys(mergedDetails),
192
+ details: mergedDetails,
159
193
  description,
160
194
  info: $$('div.nex_drama_sums').html(),
161
195
  links,
162
196
  });
163
197
  item.pubDate = timezone(parseDate(pubDate, 'YYYY-M-D HH:mm:ss'), +8);
164
- item.category = Object.values(details)
198
+ item.category = Object.values(mergedDetails)
165
199
  .flatMap((c) => c.split(/\s/))
166
200
  .filter(Boolean);
167
- item.author = details['导演'];
201
+ item.author = mergedDetails['导演'];
168
202
  item.content = {
169
203
  html: description,
170
204
  text: $$('div.nex_drama_intros').text(),
@@ -1,4 +1,4 @@
1
- import { Route } from '@/types';
1
+ import { Route, ViewType } from '@/types';
2
2
  import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
@@ -10,7 +10,8 @@ import { baseUrl, getTribeDetail, getTribeSets } from './utils';
10
10
 
11
11
  export const route: Route = {
12
12
  path: '/tribe/set/:id',
13
- categories: ['picture'],
13
+ categories: ['picture', 'popular'],
14
+ view: ViewType.Pictures,
14
15
  example: '/500px/tribe/set/f5de0b8aa6d54ec486f5e79616418001',
15
16
  parameters: { id: '部落 ID' },
16
17
  name: '部落影集',
@@ -2,6 +2,10 @@ import { Route } from '@/types';
2
2
  import { parseDate } from '@/utils/parse-date';
3
3
  import got from '@/utils/got';
4
4
  import { getToken, sign } from './utils';
5
+ import { load } from 'cheerio';
6
+ import cache from '@/utils/cache';
7
+ import ofetch from '@/utils/ofetch';
8
+ import logger from '@/utils/logger';
5
9
 
6
10
  export const route: Route = {
7
11
  path: '/index/recommend',
@@ -13,11 +17,46 @@ export const route: Route = {
13
17
  },
14
18
  ],
15
19
  name: '推荐',
16
- maintainers: ['cnkmmk'],
20
+ maintainers: ['cnkmmk', 'ovo-tim'],
17
21
  handler,
18
22
  url: '51cto.com/',
19
23
  };
20
24
 
25
+ const pattern = /'(WTKkN|bOYDu|wyeCN)':\s*(\d+)/g;
26
+
27
+ async function getFullcontent(item, cookie = '') {
28
+ let fullContent: null | string = null;
29
+ const articleResponse = await ofetch(item.url, {
30
+ headers: {
31
+ cookie,
32
+ },
33
+ });
34
+ const $ = load(articleResponse);
35
+
36
+ fullContent = new URL(item.url).host === 'ost.51cto.com' ? $('.posts-content').html() : $('article').html();
37
+
38
+ if (!fullContent && cookie === '') {
39
+ // If fullContent is null and haven't tried to request with cookie, try to get fullContent with cookie
40
+ try {
41
+ // More details: https://github.com/DIYgod/RSSHub/pull/16583#discussion_r1738643033
42
+ const _matches = articleResponse!.match(pattern)!.slice(0, 3);
43
+ const matches = _matches.map((str) => Number(str.split(':')[1]));
44
+ const [v1, v2, v3] = matches;
45
+ const cookie = '__tst_status=' + (v1 + v2 + v3) + '#;';
46
+ return await getFullcontent(item, cookie);
47
+ } catch (error) {
48
+ logger.error(error);
49
+ }
50
+ }
51
+
52
+ return {
53
+ title: item.title,
54
+ link: item.url,
55
+ pubDate: parseDate(item.pubdate, +8),
56
+ description: fullContent || item.abstract, // Return item.abstract if fullContent is null
57
+ };
58
+ }
59
+
21
60
  async function handler(ctx) {
22
61
  const url = 'https://api-media.51cto.com';
23
62
  const requestPath = 'index/index/recommend';
@@ -29,6 +68,7 @@ async function handler(ctx) {
29
68
  limit_time: 0,
30
69
  name_en: '',
31
70
  };
71
+
32
72
  const response = await got(`${url}/${requestPath}`, {
33
73
  searchParams: {
34
74
  ...params,
@@ -38,15 +78,13 @@ async function handler(ctx) {
38
78
  },
39
79
  });
40
80
  const list = response.data.data.data.list;
81
+
82
+ const items = await Promise.all(list.map((item) => cache.tryGet(item.url, async () => await getFullcontent(item))));
83
+
41
84
  return {
42
85
  title: '51CTO',
43
86
  link: 'https://www.51cto.com/',
44
87
  description: '51cto - 推荐',
45
- item: list.map((item) => ({
46
- title: item.title,
47
- link: item.url,
48
- pubDate: parseDate(item.pubdate, +8),
49
- description: item.abstract,
50
- })),
88
+ item: items,
51
89
  };
52
90
  }
@@ -2,5 +2,5 @@ import type { Namespace } from '@/types';
2
2
 
3
3
  export const namespace: Namespace = {
4
4
  name: 'Academia',
5
- url: 'https://www.academia.edu/',
5
+ url: 'www.academia.edu',
6
6
  };
@@ -0,0 +1,63 @@
1
+ import { Route } from '@/types';
2
+ import { parseDate } from '@/utils/parse-date';
3
+ import ofetch from '@/utils/ofetch';
4
+ import { load } from 'cheerio';
5
+
6
+ export const route: Route = {
7
+ path: 'anime/:category/:name',
8
+ name: 'Anime',
9
+ url: 'anime1.me',
10
+ maintainers: ['cxheng315'],
11
+ example: '/anime1/anime/2024年夏季/神之塔-第二季',
12
+ categories: ['anime'],
13
+ parameters: {
14
+ category: 'Anime1 Category',
15
+ name: 'Anime1 Name',
16
+ },
17
+ features: {
18
+ requireConfig: false,
19
+ requirePuppeteer: false,
20
+ antiCrawler: false,
21
+ supportBT: false,
22
+ supportPodcast: false,
23
+ supportScihub: false,
24
+ },
25
+ radar: [
26
+ {
27
+ source: ['anime1.me/category/:category/:name'],
28
+ target: '/anime/:category/:name',
29
+ },
30
+ ],
31
+ handler,
32
+ };
33
+
34
+ async function handler(ctx) {
35
+ const { category, name } = ctx.req.param();
36
+
37
+ const response = await ofetch(`https://anime1.me/category/${category}/${name}`);
38
+
39
+ const $ = load(response);
40
+
41
+ const title = $('page-title').text().trim();
42
+
43
+ const items = $('article')
44
+ .toArray()
45
+ .map((el) => {
46
+ const $el = $(el);
47
+ const title = $el.find('.entry-title a').text().trim();
48
+ return {
49
+ title,
50
+ link: $el.find('.entry-title a').attr('href'),
51
+ description: title,
52
+ pubDate: parseDate($el.find('time').attr('datetime') || ''),
53
+ itunes_item_image: $el.find('video').attr('poster'),
54
+ };
55
+ });
56
+
57
+ return {
58
+ title,
59
+ link: `https://anime1.me/category/${category}/${name}`,
60
+ description: title,
61
+ item: items,
62
+ };
63
+ }
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Anime1',
5
+ url: 'anime1.me',
6
+ };
@@ -0,0 +1,57 @@
1
+ import { Route } from '@/types';
2
+ import { parseDate } from '@/utils/parse-date';
3
+ import ofetch from '@/utils/ofetch';
4
+ import { load } from 'cheerio';
5
+
6
+ export const route: Route = {
7
+ path: 'search/:keyword',
8
+ name: 'Search',
9
+ url: 'anime1.me',
10
+ maintainers: ['cxheng315'],
11
+ example: '/anime1/search/神之塔',
12
+ categories: ['anime'],
13
+ parameters: {
14
+ keyword: 'Anime1 Search Keyword',
15
+ },
16
+ features: {
17
+ requireConfig: false,
18
+ requirePuppeteer: false,
19
+ antiCrawler: false,
20
+ supportBT: false,
21
+ supportPodcast: false,
22
+ supportScihub: false,
23
+ },
24
+ handler,
25
+ };
26
+
27
+ async function handler(ctx) {
28
+ const { keyword } = ctx.req.param();
29
+
30
+ const response = await ofetch(`https://anime1.me/?s=${keyword}`);
31
+
32
+ const $ = load(response);
33
+
34
+ const title = $('page-title').text().trim();
35
+
36
+ const items = $('article.type-post')
37
+ .toArray()
38
+ .map((el) => {
39
+ const $el = $(el);
40
+ const title = $el.find('.entry-title a').text().trim();
41
+ return {
42
+ title,
43
+ link: $el.find('.entry-title a').attr('href'),
44
+ description: title,
45
+ pubDate: parseDate($el.find('time').attr('datetime') || ''),
46
+ };
47
+ });
48
+
49
+ return {
50
+ title,
51
+ link: `https://anime1.me/?s=${keyword}`,
52
+ description: title,
53
+ itunes_author: 'Anime1',
54
+ itunes_image: 'https://anime1.me/wp-content/uploads/2021/02/cropped-1-180x180.png',
55
+ item: items,
56
+ };
57
+ }
@@ -24,7 +24,7 @@ export const route: Route = {
24
24
  name: '播客',
25
25
  maintainers: ['Acring'],
26
26
  handler,
27
- url: 'https://www.apple.com.cn/apple-podcasts/',
27
+ url: 'www.apple.com.cn/apple-podcasts/',
28
28
  };
29
29
 
30
30
  async function handler(ctx) {
@@ -2,26 +2,76 @@ import { Route } from '@/types';
2
2
  import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
5
- import got from '@/utils/got';
5
+ import ofetch from '@/utils/ofetch';
6
6
  import { parseDate } from '@/utils/parse-date';
7
7
  import { art } from '@/utils/render';
8
8
  import path from 'node:path';
9
+ import cache from '@/utils/cache';
9
10
 
10
- const getProductID = async (model) => {
11
- const searchAPI = `https://odinapi.asus.com.cn/recent-data/apiv2/SearchSuggestion?SystemCode=asus&WebsiteCode=cn&SearchKey=${model}&SearchType=ProductsAll&RowLimit=4&sitelang=cn`;
12
- const response = await got(searchAPI);
11
+ const endPoints = {
12
+ zh: {
13
+ url: 'https://odinapi.asus.com.cn/',
14
+ lang: 'cn',
15
+ websiteCode: 'cn',
16
+ },
17
+ en: {
18
+ url: 'https://odinapi.asus.com/',
19
+ lang: 'en',
20
+ websiteCode: 'global',
21
+ },
22
+ };
13
23
 
14
- return {
15
- productID: response.data.Result[0].Content[0].DataId,
16
- url: response.data.Result[0].Content[0].Url,
17
- };
24
+ const getProductInfo = (model, language) => {
25
+ const currentEndpoint = endPoints[language] ?? endPoints.zh;
26
+ const { url, lang, websiteCode } = currentEndpoint;
27
+
28
+ const searchAPI = `${url}recent-data/apiv2/SearchSuggestion?SystemCode=asus&WebsiteCode=${websiteCode}&SearchKey=${model}&SearchType=ProductsAll&RowLimit=4&sitelang=${lang}`;
29
+
30
+ return cache.tryGet(`asus:bios:${model}:${language}`, async () => {
31
+ const response = await ofetch(searchAPI);
32
+ const product = response.Result[0].Content[0];
33
+
34
+ return {
35
+ productID: product.DataId,
36
+ hashId: product.HashId,
37
+ url: product.Url,
38
+ title: product.Title,
39
+ image: product.ImageURL,
40
+ m1Id: product.M1Id,
41
+ productLine: product.ProductLine,
42
+ };
43
+ }) as Promise<{
44
+ productID: string;
45
+ hashId: string;
46
+ url: string;
47
+ title: string;
48
+ image: string;
49
+ m1Id: string;
50
+ productLine: string;
51
+ }>;
18
52
  };
19
53
 
20
54
  export const route: Route = {
21
- path: '/bios/:model',
55
+ path: '/bios/:model/:lang?',
22
56
  categories: ['program-update'],
23
- example: '/asus/bios/RT-AX88U',
24
- parameters: { model: 'Model, can be found in product page' },
57
+ example: '/asus/bios/RT-AX88U/zh',
58
+ parameters: {
59
+ model: 'Model, can be found in product page',
60
+ lang: {
61
+ description: 'Language, provide access routes for other parts of the world',
62
+ options: [
63
+ {
64
+ label: 'Chinese',
65
+ value: 'zh',
66
+ },
67
+ {
68
+ label: 'Global',
69
+ value: 'en',
70
+ },
71
+ ],
72
+ default: 'en',
73
+ },
74
+ },
25
75
  features: {
26
76
  requireConfig: false,
27
77
  requirePuppeteer: false,
@@ -32,36 +82,53 @@ export const route: Route = {
32
82
  },
33
83
  radar: [
34
84
  {
35
- source: ['asus.com.cn/'],
85
+ source: [
86
+ 'www.asus.com/displays-desktops/:productLine/:series/:model',
87
+ 'www.asus.com/laptops/:productLine/:series/:model',
88
+ 'www.asus.com/motherboards-components/:productLine/:series/:model',
89
+ 'www.asus.com/networking-iot-servers/:productLine/:series/:model',
90
+ 'www.asus.com/:region/displays-desktops/:productLine/:series/:model',
91
+ 'www.asus.com/:region/laptops/:productLine/:series/:model',
92
+ 'www.asus.com/:region/motherboards-components/:productLine/:series/:model',
93
+ 'www.asus.com/:region/networking-iot-servers/:productLine/:series/:model',
94
+ 'asus.com.cn/',
95
+ ],
96
+ target: '/bios/:model',
36
97
  },
37
98
  ],
38
99
  name: 'BIOS',
39
100
  maintainers: ['Fatpandac'],
40
101
  handler,
41
- url: 'asus.com.cn/',
102
+ url: 'www.asus.com',
42
103
  };
43
104
 
44
105
  async function handler(ctx) {
45
106
  const model = ctx.req.param('model');
46
- const { productID, url } = await getProductID(model);
47
- const biosAPI = `https://www.asus.com.cn/support/api/product.asmx/GetPDBIOS?website=cn&model=${model}&pdid=${productID}&sitelang=cn`;
107
+ const language = ctx.req.param('lang') ?? 'en';
108
+ const productInfo = await getProductInfo(model, language);
109
+ const biosAPI =
110
+ language === 'zh'
111
+ ? `https://www.asus.com.cn/support/api/product.asmx/GetPDBIOS?website=cn&model=${model}&pdid=${productInfo.productID}&sitelang=cn`
112
+ : `https://www.asus.com/support/api/product.asmx/GetPDBIOS?website=global&model=${model}&pdid=${productInfo.productID}&sitelang=en`;
48
113
 
49
- const response = await got(biosAPI);
50
- const biosList = response.data.Result.Obj[0].Files;
114
+ const response = await ofetch(biosAPI);
115
+ const biosList = response.Result.Obj[0].Files;
51
116
 
52
117
  const items = biosList.map((item) => ({
53
118
  title: item.Title,
54
119
  description: art(path.join(__dirname, 'templates/bios.art'), {
55
120
  item,
121
+ language,
56
122
  }),
57
- guid: url + item.Version,
123
+ guid: productInfo.url + item.Version,
58
124
  pubDate: parseDate(item.ReleaseDate, 'YYYY/MM/DD'),
59
- link: url,
125
+ link: productInfo.url,
60
126
  }));
61
127
 
62
128
  return {
63
- title: `${model} BIOS`,
64
- link: url,
129
+ title: `${productInfo.title} BIOS`,
130
+ link: productInfo.url,
131
+ image: productInfo.image,
65
132
  item: items,
66
133
  };
67
134
  }
@@ -1,6 +1,13 @@
1
- <p>更新信息:</p>
2
- {{@ item.Description}}
3
- <p>版本: {{item.Version}}</p>
4
- <p>大小: {{item.FileSize}}</p>
5
- <p>更新日期: {{item.ReleaseDate}}</p>
6
- <p>下载链接: <a href="{{item.DownloadUrl.China}}">中国下载</a> | <a href="{{item.DownloadUrl.Global}}">全球下载</a></p>
1
+ {{ if language !== 'zh' }}
2
+ <p><b>Changes:</b></p>
3
+ {{@ item.Description}}
4
+ <p><b>Version:</b> {{item.Version}}</p>
5
+ <p><b>Size:</b> {{item.FileSize}}</p>
6
+ <p><b>Download:</b> <a href="{{ item.DownloadUrl.Global }}">{{ item.DownloadUrl.Global.split('/').pop().split('?')[0] }}</a></p>
7
+ {{ else }}
8
+ <p>更新信息:</p>
9
+ {{@ item.Description}}
10
+ <p>版本: {{item.Version}}</p>
11
+ <p>大小: {{item.FileSize}}</p>
12
+ <p>下载链接: <a href="{{item.DownloadUrl.China}}">中国下载</a> | <a href="{{item.DownloadUrl.Global}}">全球下载</a></p>
13
+ {{ /if }}
@@ -1,4 +1,4 @@
1
- import { Route } from '@/types';
1
+ import { Route, ViewType } from '@/types';
2
2
  import cache from '@/utils/cache';
3
3
  import got from '@/utils/got';
4
4
  import { load } from 'cheerio';
@@ -6,9 +6,20 @@ import { parseDate } from '@/utils/parse-date';
6
6
 
7
7
  export const route: Route = {
8
8
  path: '/:user/:type?',
9
- categories: ['design'],
9
+ categories: ['design', 'popular'],
10
+ view: ViewType.Pictures,
10
11
  example: '/behance/mishapetrick',
11
- parameters: { user: 'username', type: 'type, `projects` or `appreciated`, `projects` by default' },
12
+ parameters: {
13
+ user: 'username',
14
+ type: {
15
+ description: 'type',
16
+ options: [
17
+ { value: 'projects', label: 'projects' },
18
+ { value: 'appreciated', label: 'appreciated' },
19
+ ],
20
+ default: 'projects',
21
+ },
22
+ },
12
23
  features: {
13
24
  requireConfig: false,
14
25
  requirePuppeteer: false,
@@ -9,8 +9,8 @@ export const handler = async (ctx) => {
9
9
  const { category = 'jgzx/xwzx' } = ctx.req.param();
10
10
  const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 15;
11
11
 
12
- const rootUrl = 'http://www.beijingprice.cn';
13
- const apiRootUrl = 'http://www.beijingprice.cn:8086';
12
+ const rootUrl = 'https://www.beijingprice.cn';
13
+ const apiRootUrl = 'https://www.beijingprice.cn:8086';
14
14
  const currentUrl = new URL(category.endsWith('/') ? category : `${category}/`, rootUrl).href;
15
15
  const apiNewsUrl = new URL('price/priceInformation/MorningDayWeekNews/MorningNews', apiRootUrl).href;
16
16
 
@@ -114,21 +114,21 @@ export const route: Route = {
114
114
  example: '/beijingprice/jgzx/xwzx',
115
115
  parameters: { category: '分类,默认为 `jgzx/xwzx` 即新闻资讯,可在对应分类页 URL 中找到' },
116
116
  description: `:::tip
117
- 若订阅 [新闻资讯](http://www.beijingprice.cn/jgzx/xwzx/),网址为 \`http://www.beijingprice.cn/jgzx/xwzx/\`。截取 \`https://beijingprice.cn/\` 到末尾 \`/\` 的部分 \`jgzx/xwzx\` 作为参数填入,此时路由为 [\`/beijingprice/jgzx/xwzx\`](https://rsshub.app/beijingprice/jgzx/xwzx)。
117
+ 若订阅 [新闻资讯](https://www.beijingprice.cn/jgzx/xwzx/),网址为 \`https://www.beijingprice.cn/jgzx/xwzx/\`。截取 \`https://beijingprice.cn/\` 到末尾 \`/\` 的部分 \`jgzx/xwzx\` 作为参数填入,此时路由为 [\`/beijingprice/jgzx/xwzx\`](https://rsshub.app/beijingprice/jgzx/xwzx)。
118
118
  :::
119
119
 
120
- #### [价格资讯](http://www.beijingprice.cn/jgzx/xwzx/)
120
+ #### [价格资讯](https://www.beijingprice.cn/jgzx/xwzx/)
121
121
 
122
- | [新闻资讯](http://www.beijingprice.cn/jgzx/xwzx/) | [工作动态](http://www.beijingprice.cn/jgzx/gzdt/) | [各区动态](http://www.beijingprice.cn/jgzx/gqdt/) | [通知公告](http://www.beijingprice.cn/jgzx/tzgg/) | [价格早报](http://www.beijingprice.cn/jgzx/jgzb/) |
123
- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
124
- | [jgzx/xwzx](https://rsshub.app//beijingprice/jgzx/xwzx) | [jgzx/gzdt](https://rsshub.app//beijingprice/jgzx/gzdt) | [jgzx/gqdt](https://rsshub.app//beijingprice/jgzx/gqdt) | [jgzx/tzgg](https://rsshub.app//beijingprice/jgzx/tzgg) | [jgzx/jgzb](https://rsshub.app//beijingprice/jgzx/jgzb) |
122
+ | [新闻资讯](https://www.beijingprice.cn/jgzx/xwzx/) | [工作动态](https://www.beijingprice.cn/jgzx/gzdt/) | [各区动态](https://www.beijingprice.cn/jgzx/gqdt/) | [通知公告](https://www.beijingprice.cn/jgzx/tzgg/) | [价格早报](https://www.beijingprice.cn/jgzx/jgzb/) |
123
+ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ |
124
+ | [jgzx/xwzx](https://rsshub.app/beijingprice/jgzx/xwzx) | [jgzx/gzdt](https://rsshub.app/beijingprice/jgzx/gzdt) | [jgzx/gqdt](https://rsshub.app/beijingprice/jgzx/gqdt) | [jgzx/tzgg](https://rsshub.app/beijingprice/jgzx/tzgg) | [jgzx/jgzb](https://rsshub.app/beijingprice/jgzx/jgzb) |
125
125
 
126
- #### [综合信息](http://www.beijingprice.cn/zhxx/cbjs/)
126
+ #### [综合信息](https://www.beijingprice.cn/zhxx/cbjs/)
127
127
 
128
- | [价格听证](http://www.beijingprice.cn/zhxx/jgtz/) | [价格监测定点单位名单](http://www.beijingprice.cn/zhxx/jgjcdddwmd/) | [部门预算决算](http://www.beijingprice.cn/bmys/) |
129
- | ------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------ |
130
- | [zhxx/jgtz](https://rsshub.app//beijingprice/zhxx/jgtz) | [zhxx/jgjcdddwmd](https://rsshub.app//beijingprice/zhxx/jgjcdddwmd) | [bmys](https://rsshub.app//beijingprice/bmys) |
131
- `,
128
+ | [价格听证](https://www.beijingprice.cn/zhxx/jgtz/) | [价格监测定点单位名单](https://www.beijingprice.cn/zhxx/jgjcdddwmd/) | [部门预算决算](https://www.beijingprice.cn/bmys/) |
129
+ | ------------------------------------------------------ | -------------------------------------------------------------------- | ------------------------------------------------- |
130
+ | [zhxx/jgtz](https://rsshub.app/beijingprice/zhxx/jgtz) | [zhxx/jgjcdddwmd](https://rsshub.app/beijingprice/zhxx/jgjcdddwmd) | [bmys](https://rsshub.app/beijingprice/bmys) |
131
+ `,
132
132
  categories: ['government'],
133
133
 
134
134
  features: {
@@ -1,4 +1,4 @@
1
- import { Route } from '@/types';
1
+ import { Route, ViewType } from '@/types';
2
2
  import got from '@/utils/got';
3
3
 
4
4
  export const route: Route = {
@@ -8,7 +8,8 @@ export const route: Route = {
8
8
  mediaid: '番剧媒体 id, 番剧主页 URL 中获取',
9
9
  },
10
10
  example: '/bilibili/bangumi/media/9192',
11
- categories: ['social-media'],
11
+ categories: ['social-media', 'popular'],
12
+ view: ViewType.Videos,
12
13
  maintainers: ['DIYgod'],
13
14
  handler,
14
15
  };