rsshub 1.0.0-master.cb539ff → 1.0.0-master.cb551b4

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 (81) hide show
  1. package/lib/config.ts +2 -0
  2. package/lib/index.ts +3 -0
  3. package/lib/routes/aeon/category.ts +34 -17
  4. package/lib/routes/aeon/templates/essay.art +8 -2
  5. package/lib/routes/aeon/templates/video.art +4 -4
  6. package/lib/routes/aeon/type.ts +28 -17
  7. package/lib/routes/aeon/utils.ts +47 -17
  8. package/lib/routes/amz123/kx.ts +65 -0
  9. package/lib/routes/amz123/namespace.ts +9 -0
  10. package/lib/routes/apple/podcast.ts +10 -6
  11. package/lib/routes/bilibili/hot-search.ts +1 -1
  12. package/lib/routes/bsky/posts.ts +1 -0
  13. package/lib/routes/dingshao/namespace.ts +7 -0
  14. package/lib/routes/dingshao/share.ts +53 -0
  15. package/lib/routes/dingshao/types.ts +64 -0
  16. package/lib/routes/fastbull/express-news.ts +4 -4
  17. package/lib/routes/fastbull/namespace.ts +3 -3
  18. package/lib/routes/fastbull/news.ts +6 -6
  19. package/lib/routes/foodtalks/index.ts +75 -0
  20. package/lib/routes/foodtalks/namespace.ts +9 -0
  21. package/lib/routes/hbr/topic.ts +25 -20
  22. package/lib/routes/hellogithub/article.ts +62 -0
  23. package/lib/routes/hellogithub/index.ts +2 -2
  24. package/lib/routes/hellogithub/report.ts +1 -1
  25. package/lib/routes/hellogithub/volume.ts +1 -1
  26. package/lib/routes/ifun/n/category.ts +102 -0
  27. package/lib/routes/ifun/n/search.ts +73 -0
  28. package/lib/routes/ifun/n/tag.ts +76 -0
  29. package/lib/routes/ifun/n/util.ts +34 -0
  30. package/lib/routes/ifun/namespace.ts +9 -0
  31. package/lib/routes/isct/namespace.ts +5 -1
  32. package/lib/routes/isct/news.ts +21 -6
  33. package/lib/routes/joneslanglasalle/index.ts +310 -0
  34. package/lib/routes/joneslanglasalle/namespace.ts +13 -0
  35. package/lib/routes/joneslanglasalle/templates/description.art +21 -0
  36. package/lib/routes/latepost/index.ts +1 -1
  37. package/lib/routes/newrank/wechat.ts +6 -1
  38. package/lib/routes/parliament.uk/namespace.ts +2 -0
  39. package/lib/routes/parliament.uk/petitions.ts +191 -0
  40. package/lib/routes/parliament.uk/templates/description.art +7 -0
  41. package/lib/routes/picnob/templates/desc.art +9 -2
  42. package/lib/routes/picnob/user.ts +52 -35
  43. package/lib/routes/pinterest/namespace.ts +7 -0
  44. package/lib/routes/pinterest/types.ts +330 -0
  45. package/lib/routes/pinterest/user.ts +104 -0
  46. package/lib/routes/qingting/channel.ts +9 -9
  47. package/lib/routes/qingting/podcast.ts +13 -23
  48. package/lib/routes/shu/global.ts +94 -0
  49. package/lib/routes/shu/gs.ts +106 -0
  50. package/lib/routes/shu/index.ts +58 -41
  51. package/lib/routes/shu/jwb.ts +7 -7
  52. package/lib/routes/shu/namespace.ts +2 -1
  53. package/lib/routes/shu/xykd.ts +98 -0
  54. package/lib/routes/taiwanmobile/namespace.ts +7 -0
  55. package/lib/routes/taiwanmobile/rate-plans.ts +64 -0
  56. package/lib/routes/taptap/changelog-cn.ts +29 -0
  57. package/lib/routes/taptap/changelog-intl.ts +34 -0
  58. package/lib/routes/taptap/common/changelog.ts +40 -0
  59. package/lib/routes/taptap/common/review.ts +126 -0
  60. package/lib/routes/taptap/namespace.ts +2 -2
  61. package/lib/routes/taptap/review-cn.ts +33 -0
  62. package/lib/routes/taptap/review-intl.ts +41 -0
  63. package/lib/routes/taptap/templates/videoPost.art +0 -1
  64. package/lib/routes/taptap/topic.ts +34 -30
  65. package/lib/routes/taptap/types.ts +363 -0
  66. package/lib/routes/taptap/utils.ts +20 -20
  67. package/lib/routes/thepetcity/namespace.ts +2 -2
  68. package/lib/routes/theverge/index.ts +1 -1
  69. package/lib/routes/twitter/api/index.ts +4 -1
  70. package/lib/routes/twitter/api/web-api/api.ts +27 -26
  71. package/lib/routes/twitter/user.ts +5 -0
  72. package/lib/routes/wallstreetcn/news.ts +10 -1
  73. package/lib/routes/xiaohongshu/user.ts +10 -3
  74. package/lib/routes/xiaohongshu/util.ts +65 -5
  75. package/lib/utils/wechat-mp.ts +15 -13
  76. package/lib/views/rss3.test.ts +4 -3
  77. package/lib/views/rss3.ts +2 -1
  78. package/package.json +21 -21
  79. package/lib/routes/taptap/changelog.ts +0 -71
  80. package/lib/routes/taptap/review.ts +0 -166
  81. /package/lib/routes/agirls/{index.ts → z-index.ts} +0 -0
package/lib/config.ts CHANGED
@@ -330,6 +330,7 @@ export type Config = {
330
330
  authenticationSecret?: string[];
331
331
  phoneOrEmail?: string[];
332
332
  authToken?: string[];
333
+ thirdPartyApi?: string;
333
334
  };
334
335
  uestc: {
335
336
  bbsCookie?: string;
@@ -754,6 +755,7 @@ const calculateValue = () => {
754
755
  authenticationSecret: envs.TWITTER_AUTHENTICATION_SECRET?.split(','),
755
756
  phoneOrEmail: envs.TWITTER_PHONE_OR_EMAIL?.split(','),
756
757
  authToken: envs.TWITTER_AUTH_TOKEN?.split(','),
758
+ thirdPartyApi: envs.TWITTER_THIRD_PARTY_API,
757
759
  },
758
760
  uestc: {
759
761
  bbsCookie: envs.UESTC_BBS_COOKIE,
package/lib/index.ts CHANGED
@@ -20,6 +20,9 @@ const server = serve({
20
20
  fetch: app.fetch,
21
21
  hostname: config.listenInaddrAny ? '::' : '127.0.0.1',
22
22
  port,
23
+ serverOptions: {
24
+ maxHeaderSize: 1024 * 64,
25
+ },
23
26
  });
24
27
 
25
28
  export default server;
@@ -1,13 +1,24 @@
1
1
  import { Route } from '@/types';
2
- import { load } from 'cheerio';
3
- import got from '@/utils/got';
4
- import { getData } from './utils';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { getBuildId, getData } from './utils';
4
+ import { parseDate } from '@/utils/parse-date';
5
5
 
6
6
  export const route: Route = {
7
7
  path: '/category/:category',
8
8
  categories: ['new-media', 'popular'],
9
9
  example: '/aeon/category/philosophy',
10
- parameters: { category: 'Category' },
10
+ parameters: {
11
+ category: {
12
+ description: 'Category',
13
+ options: [
14
+ { value: 'philosophy', label: 'Philosophy' },
15
+ { value: 'science', label: 'Science' },
16
+ { value: 'psychology', label: 'Psychology' },
17
+ { value: 'society', label: 'Society' },
18
+ { value: 'culture', label: 'Culture' },
19
+ ],
20
+ },
21
+ },
11
22
  features: {
12
23
  requireConfig: false,
13
24
  requirePuppeteer: false,
@@ -18,34 +29,40 @@ export const route: Route = {
18
29
  },
19
30
  radar: [
20
31
  {
21
- source: ['aeon.aeon.co/:category'],
32
+ source: ['aeon.co/:category'],
22
33
  },
23
34
  ],
24
35
  name: 'Categories',
25
36
  maintainers: ['emdoe'],
26
37
  handler,
27
- description: `Supported categories: Philosophy, Science, Psychology, Society, and Culture.`,
28
38
  };
29
39
 
30
40
  async function handler(ctx) {
31
- const url = `https://aeon.co/${ctx.req.param('category')}`;
32
- const { data: response } = await got(url);
33
- const $ = load(response);
41
+ const category = ctx.req.param('category').toLowerCase();
42
+ const url = `https://aeon.co/category/${category}`;
43
+ const buildId = await getBuildId();
44
+ const response = await ofetch(`https://aeon.co/_next/data/${buildId}/${category}.json`);
34
45
 
35
- const data = JSON.parse($('script#__NEXT_DATA__').text());
46
+ const section = response.pageProps.section;
36
47
 
37
- const list = data.props.pageProps.section.articles.edges.map((item) => ({
38
- title: item.node.title,
39
- author: item.node.authors.map((author) => author.displayName).join(', '),
40
- link: `https://aeon.co/${item.node.type.toLowerCase()}s/${item.node.slug}`,
48
+ const list = section.articles.edges.map(({ node }) => ({
49
+ title: node.title,
50
+ description: node.standfirstLong,
51
+ author: node.authors.map((author) => author.displayName).join(', '),
52
+ link: `https://aeon.co/${node.type}s/${node.slug}`,
53
+ pubDate: parseDate(node.createdAt),
54
+ category: [node.section.title, ...node.topics.map((topic) => topic.title)],
55
+ image: node.image.url,
56
+ type: node.type,
57
+ slug: node.slug,
41
58
  }));
42
59
 
43
- const items = await getData(ctx, list);
60
+ const items = await getData(list);
44
61
 
45
62
  return {
46
- title: `AEON | ${data.props.pageProps.section.title}`,
63
+ title: `AEON | ${section.title}`,
47
64
  link: url,
48
- description: data.props.pageProps.section.metaDescription,
65
+ description: section.metaDescription,
49
66
  item: items,
50
67
  };
51
68
  }
@@ -1,3 +1,9 @@
1
- <img src="{{ banner }}" alt="">
1
+ {{ if banner.url }}
2
+ <figure>
3
+ <img src="{{ banner.url }}" alt="{{ banner.alt }}">
4
+ {{ if banner.caption }}
5
+ <figcaption>{{ banner.caption }}</figcaption>
6
+ {{ /if }}
7
+ {{ /if }}
2
8
  {{@ authorsBio }}
3
- {{@ content}}
9
+ {{@ content }}
@@ -1,10 +1,10 @@
1
1
  {{ set video = article.hosterId }}
2
2
  {{ if article.hoster === 'vimeo' }}
3
- {{ set video = "https://player.vimeo.com/video/" + video + "?dnt=1"}}
4
- {{ else if article.hoster == 'youtube' }}
3
+ {{ set video = "https://player.vimeo.com/video/" + video + "?dnt=1" }}
4
+ {{ else if article.hoster === 'youtube' }}
5
5
  {{ set video = "https://www.youtube-nocookie.com/embed/" + video }}
6
6
  {{ /if }}
7
7
 
8
8
  <iframe width="672" height="377" src="{{ video }}" frameborder="0" allowfullscreen></iframe>
9
- {{@ article.credits}}
10
- {{@ article.description}}
9
+ {{@ article.credits }}
10
+ {{@ article.description }}
@@ -1,13 +1,22 @@
1
1
  import { Route } from '@/types';
2
- import { load } from 'cheerio';
3
- import got from '@/utils/got';
4
- import { getData } from './utils';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { getBuildId, getData } from './utils';
4
+ import { parseDate } from '@/utils/parse-date';
5
5
 
6
6
  export const route: Route = {
7
7
  path: '/:type',
8
8
  categories: ['new-media', 'popular'],
9
9
  example: '/aeon/essays',
10
- parameters: { type: 'Type' },
10
+ parameters: {
11
+ type: {
12
+ description: 'Type',
13
+ options: [
14
+ { value: 'essays', label: 'Essays' },
15
+ { value: 'videos', label: 'Videos' },
16
+ { value: 'audio', label: 'Audio' },
17
+ ],
18
+ },
19
+ },
11
20
  features: {
12
21
  requireConfig: false,
13
22
  requirePuppeteer: false,
@@ -18,7 +27,7 @@ export const route: Route = {
18
27
  },
19
28
  radar: [
20
29
  {
21
- source: ['aeon.aeon.co/:type'],
30
+ source: ['aeon.co/:type'],
22
31
  },
23
32
  ],
24
33
  name: 'Types',
@@ -26,28 +35,30 @@ export const route: Route = {
26
35
  handler,
27
36
  description: `Supported types: Essays, Videos, and Audio.
28
37
 
29
- Compared to the official one, the RSS feed generated by RSSHub not only has more fine-grained options, but also eliminates pull quotes, which can't be easily distinguished from other paragraphs by any RSS reader, but only disrupt the reading flow. This feed also provides users with a bio of the author at the top.
30
-
31
- However, The content generated under \`audio\` does not contain links to audio files.`,
38
+ Compared to the official one, the RSS feed generated by RSSHub not only has more fine-grained options, but also eliminates pull quotes, which can't be easily distinguished from other paragraphs by any RSS reader, but only disrupt the reading flow. This feed also provides users with a bio of the author at the top.`,
32
39
  };
33
40
 
34
41
  async function handler(ctx) {
35
42
  const type = ctx.req.param('type');
36
- const binaryType = type === 'videos' ? 'videos' : 'essays';
37
43
  const capitalizedType = type.charAt(0).toUpperCase() + type.slice(1);
38
44
 
45
+ const buildId = await getBuildId();
39
46
  const url = `https://aeon.co/${type}`;
40
- const { data: response } = await got(url);
41
- const $ = load(response);
42
-
43
- const data = JSON.parse($('script#__NEXT_DATA__').text());
47
+ const response = await ofetch(`https://aeon.co/_next/data/${buildId}/${type}.json`);
44
48
 
45
- const list = data.props.pageProps.articles.map((item) => ({
46
- title: item.title,
47
- link: `https://aeon.co/${binaryType}/${item.slug}`,
49
+ const list = response.pageProps.articles.map((node) => ({
50
+ title: node.title,
51
+ description: node.standfirstLong,
52
+ author: node.authors.map((author) => author.displayName).join(', '),
53
+ link: `https://aeon.co/${node.type}s/${node.slug}`,
54
+ pubDate: parseDate(node.createdAt),
55
+ category: [node.section.title, ...node.topics.map((topic) => topic.title)],
56
+ image: node.image.url,
57
+ type: node.type,
58
+ slug: node.slug,
48
59
  }));
49
60
 
50
- const items = await getData(ctx, list);
61
+ const items = await getData(list);
51
62
 
52
63
  return {
53
64
  title: `AEON | ${capitalizedType}`,
@@ -3,28 +3,61 @@ const __dirname = getCurrentPath(import.meta.url);
3
3
 
4
4
  import cache from '@/utils/cache';
5
5
  import { load } from 'cheerio';
6
- import got from '@/utils/got';
6
+ import ofetch from '@/utils/ofetch';
7
7
  import { art } from '@/utils/render';
8
8
  import path from 'node:path';
9
+ import { config } from '@/config';
10
+ import { parseDate } from '@/utils/parse-date';
9
11
 
10
- const getData = async (ctx, list) => {
12
+ export const getBuildId = () =>
13
+ cache.tryGet(
14
+ 'aeon:buildId',
15
+ async () => {
16
+ const response = await ofetch('https://aeon.co');
17
+ const $ = load(response);
18
+ const nextData = JSON.parse($('script#__NEXT_DATA__').text());
19
+ return nextData.buildId;
20
+ },
21
+ config.cache.routeExpire,
22
+ false
23
+ );
24
+
25
+ const getData = async (list) => {
11
26
  const items = await Promise.all(
12
27
  list.map((item) =>
13
28
  cache.tryGet(item.link, async () => {
14
- const { data: response } = await got(item.link);
15
- const $ = load(response);
29
+ const buildId = await getBuildId();
30
+ const response = await ofetch(`https://aeon.co/_next/data/${buildId}/${item.type}s/${item.slug}.json?id=${item.slug}`);
16
31
 
17
- const data = JSON.parse($('script#__NEXT_DATA__').text());
18
- const type = data.props.pageProps.article.type.toLowerCase();
32
+ const data = response.pageProps.article;
33
+ const type = data.type.toLowerCase();
19
34
 
20
- item.pubDate = new Date(data.props.pageProps.article.publishedAt).toUTCString();
35
+ item.pubDate = parseDate(data.publishedAt);
21
36
 
22
37
  if (type === 'video') {
23
- item.description = art(path.join(__dirname, 'templates/video.art'), { article: data.props.pageProps.article });
38
+ item.description = art(path.join(__dirname, 'templates/video.art'), { article: data });
24
39
  } else {
25
- // Essay or Audio
26
- // But unfortunately, the method based on __NEXT_DATA__
27
- // does not include the information of the audio link.
40
+ if (data.audio?.id) {
41
+ const response = await ofetch('https://api.aeonmedia.co/graphql', {
42
+ method: 'POST',
43
+ body: {
44
+ query: `query getAudio($audioId: ID!) {
45
+ audio(id: $audioId) {
46
+ id
47
+ streamUrl
48
+ }
49
+ }`,
50
+ variables: {
51
+ audioId: data.audio.id,
52
+ },
53
+ operationName: 'getAudio',
54
+ },
55
+ });
56
+
57
+ delete item.image;
58
+ item.enclosure_url = response.data.audio.streamUrl;
59
+ item.enclosure_type = 'audio/mpeg';
60
+ }
28
61
 
29
62
  // Besides, it seems that the method based on __NEXT_DATA__
30
63
  // does not include the information of the two-column
@@ -32,14 +65,11 @@ const getData = async (ctx, list) => {
32
65
  // e.g. https://aeon.co/essays/how-to-mourn-a-forest-a-lesson-from-west-papua .
33
66
  // But that's very rare.
34
67
 
35
- item.author = data.props.pageProps.article.authors.map((author) => author.name).join(', ');
36
-
37
- const article = data.props.pageProps.article;
38
- const capture = load(article.body);
39
- const banner = article.image?.url;
68
+ const capture = load(data.body, null, false);
69
+ const banner = data.image;
40
70
  capture('p.pullquote').remove();
41
71
 
42
- const authorsBio = article.authors.map((author) => '<p>' + author.name + author.authorBio.replaceAll(/^<p>/g, ' ')).join('');
72
+ const authorsBio = data.authors.map((author) => '<p>' + author.name + author.authorBio.replaceAll(/^<p>/g, ' ')).join('');
43
73
 
44
74
  item.description = art(path.join(__dirname, 'templates/essay.art'), { banner, authorsBio, content: capture.html() });
45
75
  }
@@ -0,0 +1,65 @@
1
+ import { Route, ViewType } from '@/types';
2
+ import got from '@/utils/got';
3
+ import { parseDate } from '@/utils/parse-date';
4
+
5
+ export const route: Route = {
6
+ path: '/kx',
7
+ categories: ['new-media'],
8
+ example: '/amz123/kx',
9
+ parameters: {},
10
+ features: {
11
+ requireConfig: false,
12
+ requirePuppeteer: false,
13
+ antiCrawler: false,
14
+ supportBT: false,
15
+ supportPodcast: false,
16
+ supportScihub: false,
17
+ },
18
+ radar: [
19
+ {
20
+ source: ['amz123.com/kx'],
21
+ target: '/kx',
22
+ },
23
+ ],
24
+ name: 'AMZ123 快讯',
25
+ maintainers: ['defp'],
26
+ handler,
27
+ url: 'amz123.com/kx',
28
+ view: ViewType.Articles,
29
+ };
30
+
31
+ async function handler() {
32
+ const limit = 12;
33
+ const apiRootUrl = 'https://api.amz123.com';
34
+ const rootUrl = 'https://www.amz123.com';
35
+
36
+ const { data: response } = await got.post(`${apiRootUrl}/ugc/v1/user_content/forum_list`, {
37
+ json: {
38
+ page: 1,
39
+ page_size: limit,
40
+ tag_id: 0,
41
+ fid: 4,
42
+ ban: 0,
43
+ is_new: 1,
44
+ },
45
+ headers: {
46
+ 'content-type': 'application/json',
47
+ },
48
+ });
49
+
50
+ const items = response.data.rows.map((item) => ({
51
+ title: item.title,
52
+ description: item.description,
53
+ pubDate: parseDate(item.published_at * 1000),
54
+ link: `${rootUrl}/kx/${item.id}`,
55
+ author: item.author?.username,
56
+ category: item.tags.map((tag) => tag.name),
57
+ guid: item.resource_id,
58
+ }));
59
+
60
+ return {
61
+ title: 'AMZ123 快讯',
62
+ link: `${rootUrl}/kx`,
63
+ item: items,
64
+ };
65
+ }
@@ -0,0 +1,9 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'Amz123',
5
+ url: 'www.amz123.com',
6
+ categories: ['new-media'],
7
+ description: '跨境电商平台',
8
+ lang: 'zh-CN',
9
+ };
@@ -4,10 +4,13 @@ import { load } from 'cheerio';
4
4
  import { parseDate } from '@/utils/parse-date';
5
5
 
6
6
  export const route: Route = {
7
- path: '/podcast/:id',
7
+ path: '/podcast/:id/:region?',
8
8
  categories: ['multimedia'],
9
- example: '/apple/podcast/id1559695855',
10
- parameters: { id: '播客id,可以在 Apple 播客app 内分享的播客的 URL 中找到' },
9
+ example: '/apple/podcast/id1559695855/cn',
10
+ parameters: {
11
+ id: '播客id,可以在 Apple 播客app 内分享的播客的 URL 中找到',
12
+ region: '地區代碼,例如 cn、us、jp,預設為 cn',
13
+ },
11
14
  features: {
12
15
  requireConfig: false,
13
16
  requirePuppeteer: false,
@@ -18,17 +21,18 @@ export const route: Route = {
18
21
  },
19
22
  radar: [
20
23
  {
21
- source: ['podcasts.apple.com/cn/podcast/:id'],
24
+ source: ['podcasts.apple.com/:region/podcast/:id'],
22
25
  },
23
26
  ],
24
27
  name: '播客',
25
28
  maintainers: ['Acring'],
26
29
  handler,
27
- url: 'www.apple.com.cn/apple-podcasts/',
30
+ url: 'www.apple.com/apple-podcasts/',
28
31
  };
29
32
 
30
33
  async function handler(ctx) {
31
- const link = `https://podcasts.apple.com/cn/podcast/${ctx.req.param('id')}`;
34
+ const { id, region } = ctx.req.param();
35
+ const link = `https://podcasts.apple.com/${region || `cn`}/podcast/${id}`;
32
36
  const response = await got({
33
37
  method: 'get',
34
38
  url: link,
@@ -18,7 +18,7 @@ export const route: Route = {
18
18
  },
19
19
  radar: [
20
20
  {
21
- source: ['www.bilibili.com/'],
21
+ source: ['www.bilibili.com/', 'm.bilibili.com/'],
22
22
  },
23
23
  ],
24
24
  name: '热搜',
@@ -85,5 +85,6 @@ async function handler(ctx) {
85
85
  icon: profile.avatar,
86
86
  logo: profile.avatar,
87
87
  item: items,
88
+ allowEmpty: true,
88
89
  };
89
90
  }
@@ -0,0 +1,7 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: '盯梢',
5
+ url: 'www.dingshao.cn',
6
+ lang: 'zh-CN',
7
+ };
@@ -0,0 +1,53 @@
1
+ import { Route } from '@/types';
2
+ import ofetch from '@/utils/ofetch';
3
+ import { parseDate } from '@/utils/parse-date';
4
+ import type { Context } from 'hono';
5
+ import { Value } from './types';
6
+
7
+ export const route: Route = {
8
+ path: '/share/:shortId',
9
+ categories: ['other'],
10
+ example: '/dingshao/share/FzFypN',
11
+ parameters: {
12
+ shortId: '频道 ID',
13
+ },
14
+ radar: [
15
+ {
16
+ source: ['www.dingshao.cn/share/:shortId'],
17
+ },
18
+ ],
19
+ name: '频道',
20
+ maintainers: ['TonyRL'],
21
+ handler,
22
+ };
23
+
24
+ const baseUrl = 'https://www.dingshao.cn';
25
+
26
+ async function handler(ctx: Context) {
27
+ const { shortId } = ctx.req.param();
28
+
29
+ const response = await ofetch<Value>(`${baseUrl}/api/v2/channel/get-channel-and-recent-messages-by-short-id`, {
30
+ method: 'POST',
31
+ body: {
32
+ shortId,
33
+ },
34
+ });
35
+
36
+ const items = response.value.bundle.channelMessages.map((message) => ({
37
+ title: message.excerpt.split('\n')[0],
38
+ description: message.content,
39
+ pubDate: parseDate(message.publishedAt),
40
+ category: message.tags,
41
+ link: `${baseUrl}/channel/${response.value.channel}/${message.id}`,
42
+ }));
43
+
44
+ const channelProfile = response.value.bundle.channels.find((channel) => channel.id === response.value.channel)?.profile;
45
+
46
+ return {
47
+ title: channelProfile?.name,
48
+ description: channelProfile?.description,
49
+ link: `${baseUrl}/share/${shortId}`,
50
+ image: channelProfile?.image,
51
+ item: items,
52
+ };
53
+ }
@@ -0,0 +1,64 @@
1
+ export interface Value {
2
+ value: {
3
+ channel: string;
4
+ recentMessages: string[];
5
+ bundle: Bundle;
6
+ };
7
+ }
8
+
9
+ interface Bundle {
10
+ channels: Channel[];
11
+ users: User[];
12
+ channelMessages: ChannelMessage[];
13
+ channelMessageInteractions: any[];
14
+ }
15
+
16
+ interface Channel {
17
+ id: string;
18
+ owner: string;
19
+ profile: Profile;
20
+ tags: string[];
21
+ script: Script;
22
+ private: boolean;
23
+ stats: Stats;
24
+ sharable: boolean;
25
+ lastPublishedAt: string;
26
+ }
27
+
28
+ interface Profile {
29
+ name: string;
30
+ description: string;
31
+ image: string;
32
+ }
33
+
34
+ interface Script {
35
+ homepage: string;
36
+ }
37
+
38
+ interface Stats {
39
+ subscribers: number;
40
+ }
41
+
42
+ interface User {
43
+ id: string;
44
+ profile: UserProfile;
45
+ }
46
+
47
+ interface UserProfile {
48
+ name: string;
49
+ image: string;
50
+ }
51
+
52
+ interface ChannelMessage {
53
+ id: string;
54
+ channel: string;
55
+ author: string;
56
+ tags: string[];
57
+ excerpt: string;
58
+ content: string;
59
+ likes: number;
60
+ private: boolean;
61
+ sharable: boolean;
62
+ script: boolean;
63
+ publishedAt: string;
64
+ }
@@ -19,17 +19,17 @@ export const route: Route = {
19
19
  },
20
20
  radar: [
21
21
  {
22
- source: ['fastbull.cn/express-news', 'fastbull.cn/'],
22
+ source: ['fastbull.com/express-news', 'fastbull.com/'],
23
23
  },
24
24
  ],
25
- name: '快讯',
25
+ name: 'News Flash',
26
26
  maintainers: ['nczitzk'],
27
27
  handler,
28
- url: 'fastbull.cn/express-news',
28
+ url: 'fastbull.com/express-news',
29
29
  };
30
30
 
31
31
  async function handler() {
32
- const rootUrl = 'https://www.fastbull.cn';
32
+ const rootUrl = 'https://www.fastbull.com';
33
33
  const currentUrl = `${rootUrl}/express-news`;
34
34
 
35
35
  const response = await got({
@@ -1,7 +1,7 @@
1
1
  import type { Namespace } from '@/types';
2
2
 
3
3
  export const namespace: Namespace = {
4
- name: '法布财经',
5
- url: 'fastbull.cn',
6
- lang: 'zh-CN',
4
+ name: 'FastBull',
5
+ url: 'fastbull.com',
6
+ lang: 'en',
7
7
  };
@@ -10,7 +10,7 @@ import { art } from '@/utils/render';
10
10
  import path from 'node:path';
11
11
 
12
12
  export const route: Route = {
13
- path: ['/news', '/'],
13
+ path: '/news',
14
14
  categories: ['finance', 'popular'],
15
15
  view: ViewType.Articles,
16
16
  example: '/fastbull/news',
@@ -25,18 +25,18 @@ export const route: Route = {
25
25
  },
26
26
  radar: [
27
27
  {
28
- source: ['fastbull.cn/news', 'fastbull.cn/'],
28
+ source: ['fastbull.com/cn/news', 'fastbull.com/cn'],
29
29
  },
30
30
  ],
31
- name: '新闻',
31
+ name: 'News',
32
32
  maintainers: ['nczitzk'],
33
33
  handler,
34
- url: 'fastbull.cn/news',
34
+ url: 'fastbull.com/news',
35
35
  };
36
36
 
37
37
  async function handler() {
38
- const rootUrl = 'https://www.fastbull.cn';
39
- const currentUrl = `${rootUrl}/news`;
38
+ const rootUrl = 'https://www.fastbull.com';
39
+ const currentUrl = `${rootUrl}/cn/news`;
40
40
 
41
41
  const response = await got({
42
42
  method: 'get',