rsshub 1.0.0-master.c183692 → 1.0.0-master.c1913c8

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 (103) hide show
  1. package/README.md +6 -9
  2. package/lib/config.ts +18 -0
  3. package/lib/errors/index.tsx +1 -1
  4. package/lib/middleware/logger.ts +2 -2
  5. package/lib/routes/abc/index.ts +2 -2
  6. package/lib/routes/apnews/api.ts +6 -1
  7. package/lib/routes/apnews/rss.ts +1 -1
  8. package/lib/routes/apnews/sitemap.ts +2 -1
  9. package/lib/routes/apnews/topics.ts +2 -2
  10. package/lib/routes/asus/bios.ts +39 -6
  11. package/lib/routes/bilibili/bilibili-recommend.ts +42 -0
  12. package/lib/routes/bilibili/cache.ts +22 -0
  13. package/lib/routes/bilibili/dynamic.ts +101 -97
  14. package/lib/routes/bilibili/followings-video.ts +9 -3
  15. package/lib/routes/bilibili/utils.ts +5 -0
  16. package/lib/routes/bilibili/video.ts +2 -1
  17. package/lib/routes/bitget/announcement.ts +200 -0
  18. package/lib/routes/bitget/namespace.ts +6 -0
  19. package/lib/routes/bitget/type.ts +26 -0
  20. package/lib/routes/bjp/apod.ts +4 -2
  21. package/lib/routes/bupt/jwc.ts +130 -0
  22. package/lib/routes/ccfa/index.ts +216 -0
  23. package/lib/routes/ccfa/namespace.ts +8 -0
  24. package/lib/routes/ccfa/templates/description.art +7 -0
  25. package/lib/routes/devtrium/namespace.ts +6 -0
  26. package/lib/routes/devtrium/posts.ts +55 -0
  27. package/lib/routes/discourse/official.ts +55 -0
  28. package/lib/routes/dockerhub/utils.ts +4 -3
  29. package/lib/routes/douban/movie/coming.ts +68 -0
  30. package/lib/routes/douban/templates/movie_coming.art +27 -0
  31. package/lib/routes/follow/profile.ts +35 -5
  32. package/lib/routes/github/comments.ts +32 -30
  33. package/lib/routes/gov/cn/namespace.ts +8 -0
  34. package/lib/routes/gov/{news → cn/news}/index.ts +11 -7
  35. package/lib/routes/gov/ndrc/fggz.ts +637 -2
  36. package/lib/routes/gov/ndrc/namespace.ts +8 -0
  37. package/lib/routes/gov/ndrc/xwdt.ts +28 -8
  38. package/lib/routes/gov/ndrc/zfxxgk/articles.ts +73 -0
  39. package/lib/routes/hpoi/all.ts +3 -2
  40. package/lib/routes/hpoi/character.ts +3 -2
  41. package/lib/routes/hpoi/work.ts +3 -2
  42. package/lib/routes/jjwxc/book.ts +18 -14
  43. package/lib/routes/lofter/collection.ts +87 -0
  44. package/lib/routes/malaysiakini/index.ts +179 -0
  45. package/lib/routes/malaysiakini/namespace.ts +11 -0
  46. package/lib/routes/mastodon/acct.ts +4 -3
  47. package/lib/routes/mastodon/timeline-local.ts +3 -2
  48. package/lib/routes/mastodon/timeline-remote.ts +3 -2
  49. package/lib/routes/meishichina/index.ts +1997 -0
  50. package/lib/routes/meishichina/namespace.ts +8 -0
  51. package/lib/routes/oct0pu5/namespace.ts +10 -0
  52. package/lib/routes/oct0pu5/rss.ts +48 -0
  53. package/lib/routes/pconline/focus.ts +143 -0
  54. package/lib/routes/pconline/namespace.ts +10 -0
  55. package/lib/routes/people/index.ts +6 -2
  56. package/lib/routes/pixivision/index.ts +84 -0
  57. package/lib/routes/pixivision/namespace.ts +6 -0
  58. package/lib/routes/pixivision/utils.ts +86 -0
  59. package/lib/routes/pku/bbs/hot.ts +1 -1
  60. package/lib/routes/pornhub/category.ts +3 -2
  61. package/lib/routes/pornhub/model.ts +4 -3
  62. package/lib/routes/pornhub/pornstar.ts +4 -3
  63. package/lib/routes/pornhub/search.ts +3 -2
  64. package/lib/routes/qiche365/namespace.ts +5 -0
  65. package/lib/routes/qiche365/recall.ts +53 -0
  66. package/lib/routes/sdu/{cs.ts → cs/index.ts} +46 -12
  67. package/lib/routes/sdu/namespace.ts +2 -2
  68. package/lib/routes/soundon/namespace.ts +6 -0
  69. package/lib/routes/soundon/podcast.ts +80 -0
  70. package/lib/routes/soundon/types.ts +67 -0
  71. package/lib/routes/swjtu/scai/bks.ts +80 -0
  72. package/lib/routes/telegram/blog.ts +3 -2
  73. package/lib/routes/telegram/stickerpack.ts +3 -2
  74. package/lib/routes/tencent/news/author.ts +2 -1
  75. package/lib/routes/the/index.ts +3 -2
  76. package/lib/routes/theinitium/app.ts +137 -0
  77. package/lib/routes/theinitium/templates/description.art +17 -0
  78. package/lib/routes/threads/index.ts +26 -20
  79. package/lib/routes/tju/cic/index.ts +2 -2
  80. package/lib/routes/tju/news/index.ts +2 -2
  81. package/lib/routes/tju/oaa/index.ts +2 -2
  82. package/lib/routes/twitch/live.ts +3 -2
  83. package/lib/routes/twitch/video.ts +3 -2
  84. package/lib/routes/twitter/api/mobile-api/login.ts +1 -1
  85. package/lib/routes/twitter/api/web-api/constants.ts +15 -14
  86. package/lib/routes/twitter/api/web-api/login.ts +7 -5
  87. package/lib/routes/twitter/api/web-api/utils.ts +1 -2
  88. package/lib/routes/twitter/list.ts +5 -2
  89. package/lib/routes/twitter/tweet.ts +1 -0
  90. package/lib/routes/weibo/namespace.ts +1 -0
  91. package/lib/routes/weibo/oasis/user.ts +1 -1
  92. package/lib/routes/weibo/super-index.ts +23 -11
  93. package/lib/routes/weibo/user.ts +12 -1
  94. package/lib/routes/whu/cs.ts +11 -3
  95. package/lib/routes/whu/gs/index.ts +2 -1
  96. package/lib/routes/whu/news.ts +27 -2
  97. package/lib/routes/withgoogle/explorables.ts +54 -0
  98. package/lib/routes/withgoogle/namespace.ts +6 -0
  99. package/lib/routes/zaobao/util.ts +1 -1
  100. package/lib/routes/zhihu/zhuanlan.ts +8 -7
  101. package/lib/utils/otel/metric.ts +3 -2
  102. package/lib/views/rss.tsx +7 -0
  103. package/package.json +14 -14
@@ -1,48 +1,51 @@
1
1
  const baseUrl = 'https://x.com/i/api';
2
2
 
3
3
  const graphQLEndpointsPlain = [
4
- '/graphql/eS7LO5Jy3xgmd3dbL044EA/UserTweets',
5
- '/graphql/k5XapwcSikNsEsILW5FvgA/UserByScreenName',
6
- '/graphql/k3YiLNE_MAy5J-NANLERdg/HomeTimeline',
4
+ '/graphql/E3opETHurmVJflFsUBVuUQ/UserTweets',
5
+ '/graphql/Yka-W8dz7RaEuQNkroPkYw/UserByScreenName',
6
+ '/graphql/HJFjzBgCs16TqxewQOeLNg/HomeTimeline',
7
7
  '/graphql/DiTkXJgLqBBxCs7zaYsbtA/HomeLatestTimeline',
8
- '/graphql/3GeIaLmNhTm1YsUmxR57tg/UserTweetsAndReplies',
9
- '/graphql/TOU4gQw8wXIqpSzA4TYKgg/UserMedia',
10
- '/graphql/B8I_QCljDBVfin21TTWMqA/Likes',
8
+ '/graphql/bt4TKuFz4T7Ckk-VvQVSow/UserTweetsAndReplies',
9
+ '/graphql/dexO_2tohK86JDudXXG3Yw/UserMedia',
11
10
  '/graphql/tD8zKvQzwY3kdx5yz6YmOw/UserByRestId',
12
- '/graphql/flaR-PUMshxFWZWPNpq4zA/SearchTimeline',
13
- '/graphql/TOTgqavWmxywKv5IbMMK1w/ListLatestTweetsTimeline',
14
- '/graphql/zJvfJs3gSbrVhC0MKjt_OQ/TweetDetail',
11
+ '/graphql/UN1i3zUiCWa-6r-Uaho4fw/SearchTimeline',
12
+ '/graphql/Pa45JvqZuKcW1plybfgBlQ/ListLatestTweetsTimeline',
13
+ '/graphql/QuBlQ6SxNAQCt6-kBiCXCQ/TweetDetail',
15
14
  ];
16
15
 
17
16
  const gqlMap = Object.fromEntries(graphQLEndpointsPlain.map((endpoint) => [endpoint.split('/')[3].replace(/V2$|Query$|QueryV2$/, ''), endpoint]));
18
17
 
19
18
  const gqlFeatureUser = {
20
- hidden_profile_likes_enabled: true,
21
19
  hidden_profile_subscriptions_enabled: true,
20
+ rweb_tipjar_consumption_enabled: true,
22
21
  responsive_web_graphql_exclude_directive_enabled: true,
23
22
  verified_phone_label_enabled: false,
24
23
  subscriptions_verification_info_is_identity_verified_enabled: true,
25
24
  subscriptions_verification_info_verified_since_enabled: true,
26
25
  highlights_tweets_tab_ui_enabled: true,
27
26
  responsive_web_twitter_article_notes_tab_enabled: true,
27
+ subscriptions_feature_can_gift_premium: true,
28
28
  creator_subscriptions_tweet_preview_api_enabled: true,
29
29
  responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,
30
30
  responsive_web_graphql_timeline_navigation_enabled: true,
31
31
  };
32
32
  const gqlFeatureFeed = {
33
+ rweb_tipjar_consumption_enabled: true,
33
34
  responsive_web_graphql_exclude_directive_enabled: true,
34
35
  verified_phone_label_enabled: false,
35
36
  creator_subscriptions_tweet_preview_api_enabled: true,
36
37
  responsive_web_graphql_timeline_navigation_enabled: true,
37
38
  responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,
39
+ communities_web_enable_tweet_community_results_fetch: true,
38
40
  c9s_tweet_anatomy_moderator_badge_enabled: true,
39
- tweetypie_unmention_optimization_enabled: true,
41
+ articles_preview_enabled: true,
40
42
  responsive_web_edit_tweet_api_enabled: true,
41
43
  graphql_is_translatable_rweb_tweet_is_translatable_enabled: true,
42
44
  view_counts_everywhere_api_enabled: true,
43
45
  longform_notetweets_consumption_enabled: true,
44
46
  responsive_web_twitter_article_tweet_consumption_enabled: true,
45
47
  tweet_awards_web_tipping_enabled: false,
48
+ creator_subscriptions_quote_tweet_preview_enabled: false,
46
49
  freedom_of_speech_not_reach_fetch_enabled: true,
47
50
  standardized_nudges_misinfo: true,
48
51
  tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: true,
@@ -61,8 +64,7 @@ const TweetDetailFeatures = {
61
64
  responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,
62
65
  communities_web_enable_tweet_community_results_fetch: true,
63
66
  c9s_tweet_anatomy_moderator_badge_enabled: true,
64
- articles_preview_enabled: false,
65
- tweetypie_unmention_optimization_enabled: true,
67
+ articles_preview_enabled: true,
66
68
  responsive_web_edit_tweet_api_enabled: true,
67
69
  graphql_is_translatable_rweb_tweet_is_translatable_enabled: true,
68
70
  view_counts_everywhere_api_enabled: true,
@@ -73,7 +75,6 @@ const TweetDetailFeatures = {
73
75
  freedom_of_speech_not_reach_fetch_enabled: true,
74
76
  standardized_nudges_misinfo: true,
75
77
  tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: true,
76
- tweet_with_visibility_results_prefer_gql_media_interstitial_enabled: true,
77
78
  rweb_video_timestamps_enabled: true,
78
79
  longform_notetweets_rich_text_read_enabled: true,
79
80
  longform_notetweets_inline_media_enabled: true,
@@ -21,7 +21,7 @@ const loginLimiter = cache.clients.redisClient
21
21
  const loginLimiterQueue = new RateLimiterQueue(loginLimiter);
22
22
 
23
23
  async function login({ username, password, authenticationSecret }) {
24
- if (!username || !password || !authenticationSecret) {
24
+ if (!username || !password) {
25
25
  return;
26
26
  }
27
27
  try {
@@ -40,10 +40,12 @@ async function login({ username, password, authenticationSecret }) {
40
40
  await page.waitForSelector('input[autocomplete="current-password"]');
41
41
  await page.type('input[autocomplete="current-password"]', password);
42
42
  (await page.waitForSelector('button[data-testid="LoginForm_Login_Button"]'))?.click();
43
- await page.waitForSelector('input[inputmode="numeric"]');
44
- const token = authenticator.generate(authenticationSecret);
45
- await page.type('input[inputmode="numeric"]', token);
46
- (await page.waitForSelector('button[data-testid="ocfEnterTextNextButton"]'))?.click();
43
+ if (authenticationSecret) {
44
+ await page.waitForSelector('input[inputmode="numeric"]');
45
+ const token = authenticator.generate(authenticationSecret);
46
+ await page.type('input[inputmode="numeric"]', token);
47
+ (await page.waitForSelector('button[data-testid="ocfEnterTextNextButton"]'))?.click();
48
+ }
47
49
  const waitForRequest = new Promise<string>((resolve) => {
48
50
  page.on('requestfinished', async (request) => {
49
51
  if (request.url().includes('/HomeTimeline')) {
@@ -1,7 +1,6 @@
1
1
  import ConfigNotFoundError from '@/errors/types/config-not-found';
2
2
  import { baseUrl, gqlFeatures, bearerToken, gqlMap } from './constants';
3
3
  import { config } from '@/config';
4
- import got from '@/utils/got';
5
4
  import queryString from 'query-string';
6
5
  import { Cookie, CookieJar } from 'tough-cookie';
7
6
  import { CookieAgent, CookieClient } from 'http-cookie-agent/undici';
@@ -26,7 +25,7 @@ const token2Cookie = (token) =>
26
25
  uri: proxy.proxyUri,
27
26
  })
28
27
  : new CookieAgent({ cookies: { jar } });
29
- await got('https://x.com', {
28
+ await ofetch('https://x.com', {
30
29
  dispatcher: agent,
31
30
  });
32
31
  return JSON.stringify(jar.serializeSync());
@@ -41,11 +41,14 @@ export const route: Route = {
41
41
 
42
42
  async function handler(ctx) {
43
43
  const id = ctx.req.param('id');
44
- const { count } = utils.parseRouteParams(ctx.req.param('routeParams'));
44
+ const { count, include_rts } = utils.parseRouteParams(ctx.req.param('routeParams'));
45
45
  const params = count ? { count } : {};
46
46
 
47
47
  await api.init();
48
- const data = await api.getList(id, params);
48
+ let data = await api.getList(id, params);
49
+ if (!include_rts) {
50
+ data = utils.excludeRetweet(data);
51
+ }
49
52
 
50
53
  return {
51
54
  title: `Twitter List - ${id}`,
@@ -2,6 +2,7 @@ import { Route } from '@/types';
2
2
  import api from './api';
3
3
  import utils from './utils';
4
4
  import { fallback, queryToBoolean } from '@/utils/readable-social';
5
+ import { config } from '@/config';
5
6
 
6
7
  export const route: Route = {
7
8
  path: '/tweet/:id/status/:status/:original?',
@@ -30,6 +30,7 @@ export const namespace: Namespace = {
30
30
  | showEmojiInDescription | 是否展示正文中的微博表情,关闭则替换为 \`[表情名]\` | 0/1/true/false | true |
31
31
  | showLinkIconInDescription | 是否展示正文中的链接图标 | 0/1/true/false | true |
32
32
  | preferMobileLink | 是否使用移动版链接(默认使用 PC 版) | 0/1/true/false | false |
33
+ | showRetweeted | 是否显示转发的微博 | 0/1/true/false | true |
33
34
 
34
35
  指定更多与默认值不同的参数选项可以改善 RSS 的可读性,如
35
36
 
@@ -21,7 +21,7 @@ export const route: Route = {
21
21
  target: '/user/:uid',
22
22
  },
23
23
  ],
24
- name: '用户',
24
+ name: '绿洲用户',
25
25
  maintainers: ['kt286'],
26
26
  handler,
27
27
  };
@@ -37,11 +37,15 @@ export const route: Route = {
37
37
  | feed | 最新评论 |`,
38
38
  };
39
39
 
40
+ interface Card {
41
+ card_group?: Card[];
42
+ }
43
+
40
44
  async function handler(ctx) {
41
45
  const id = ctx.req.param('id');
42
46
  const type = ctx.req.param('type') ?? 'feed';
43
47
 
44
- const containerData = await cache.tryGet(
48
+ const containerData = (await cache.tryGet(
45
49
  `weibo:super_index:container:${id}:${type}`,
46
50
  async () => {
47
51
  const _r = await got('https://m.weibo.cn/api/container/getIndex', {
@@ -61,27 +65,35 @@ async function handler(ctx) {
61
65
  },
62
66
  config.cache.routeExpire,
63
67
  false
64
- );
68
+ )) as {
69
+ cards?: Card[];
70
+ pageInfo?: {
71
+ page_title: string;
72
+ };
73
+ };
65
74
 
66
75
  const resultItems = [];
67
76
 
68
- for (const card of containerData.cards) {
77
+ function handleCard(ctx, card, resultItems) {
78
+ if (card.card_type === '9' && 'mblog' in card) {
79
+ const formatExtended = weiboUtils.formatExtended(ctx, card.mblog, undefined);
80
+ resultItems.push(formatExtended);
81
+ }
82
+ }
83
+ for (const card of containerData?.cards ?? []) {
84
+ handleCard(ctx, card, resultItems);
69
85
  if (!('card_group' in card)) {
70
86
  continue;
71
87
  }
72
- for (const mblogCard of card.card_group) {
73
- if (mblogCard.card_type === '9' && 'mblog' in mblogCard) {
74
- const mblog = mblogCard.mblog;
75
- const formatExtended = weiboUtils.formatExtended(ctx, mblog);
76
- resultItems.push(formatExtended);
77
- }
88
+ for (const mblogCard of card.card_group!) {
89
+ handleCard(ctx, mblogCard, resultItems);
78
90
  }
79
91
  }
80
92
 
81
93
  return weiboUtils.sinaimgTvax({
82
- title: `微博超话 - ${containerData.pageInfo.page_title}`,
94
+ title: `微博超话 - ${containerData?.pageInfo?.page_title}`,
83
95
  link: `https://weibo.com/p/${id}/super_index`,
84
- description: `#${containerData.pageInfo.page_title}# 的超话`,
96
+ description: `#${containerData?.pageInfo?.page_title}# 的超话`,
85
97
  item: resultItems,
86
98
  });
87
99
  }
@@ -47,6 +47,7 @@ async function handler(ctx) {
47
47
  let displayVideo = '1';
48
48
  let displayArticle = '0';
49
49
  let displayComments = '0';
50
+ let showRetweeted = '1';
50
51
  if (ctx.req.param('routeParams')) {
51
52
  if (ctx.req.param('routeParams') === '1' || ctx.req.param('routeParams') === '0') {
52
53
  displayVideo = ctx.req.param('routeParams');
@@ -55,6 +56,7 @@ async function handler(ctx) {
55
56
  displayVideo = fallback(undefined, queryToBoolean(routeParams.displayVideo), true) ? '1' : '0';
56
57
  displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false) ? '1' : '0';
57
58
  displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0';
59
+ showRetweeted = fallback(undefined, queryToBoolean(routeParams.showRetweeted), false) ? '1' : '0';
58
60
  }
59
61
  }
60
62
  const containerData = await cache.tryGet(
@@ -102,7 +104,15 @@ async function handler(ctx) {
102
104
 
103
105
  let resultItems = await Promise.all(
104
106
  cards
105
- .filter((item) => item.mblog)
107
+ .filter((item) => {
108
+ if (item.mblog === undefined) {
109
+ return false;
110
+ }
111
+ if (showRetweeted === '0' && item.mblog.retweeted_status) {
112
+ return false;
113
+ }
114
+ return true;
115
+ })
106
116
  .map(async (item) => {
107
117
  // TODO: unify cache key and let weiboUtils.getShowData() handle the cache? It seems safe to do so.
108
118
  // Need more investigation, pending for now since the current version works fine.
@@ -180,5 +190,6 @@ async function handler(ctx) {
180
190
  description,
181
191
  image: profileImageUrl,
182
192
  item: resultItems,
193
+ allowEmpty: true,
183
194
  });
184
195
  }
@@ -71,10 +71,16 @@ async function handler(ctx) {
71
71
  };
72
72
  });
73
73
 
74
- const items = await Promise.all(
74
+ let items = await Promise.all(
75
75
  list.map((item) =>
76
76
  cache.tryGet(item.link, async () => {
77
- const response = await got(item.link);
77
+ let response;
78
+ try {
79
+ // 实测发现有些链接无法访问
80
+ response = await got(item.link);
81
+ } catch {
82
+ return null;
83
+ }
78
84
  const $ = load(response.data);
79
85
 
80
86
  if ($('.prompt').length) {
@@ -87,7 +93,8 @@ async function handler(ctx) {
87
93
  content.find('img').each((_, e) => {
88
94
  e = $(e);
89
95
  if (e.attr('orisrc')) {
90
- e.attr('src', new URL(e.attr('orisrc'), response.url).href);
96
+ const newUrl = new URL(e.attr('orisrc'), 'https://cs.whu.edu.cn');
97
+ e.attr('src', newUrl.href);
91
98
  e.removeAttr('orisrc');
92
99
  e.removeAttr('vurl');
93
100
  }
@@ -100,6 +107,7 @@ async function handler(ctx) {
100
107
  })
101
108
  )
102
109
  );
110
+ items = items.filter((item) => item !== null);
103
111
 
104
112
  return {
105
113
  title: $('title').first().text(),
@@ -46,7 +46,8 @@ export const route: Route = {
46
46
 
47
47
  async function handler(ctx) {
48
48
  const host = 'https://gs.whu.edu.cn/';
49
- const type = (ctx.params && Number.parseInt(ctx.req.param('type'))) || 0;
49
+ const paremType = ctx.req.param('type');
50
+ const type = paremType ? Number.parseInt(paremType) : 0;
50
51
  const response = await got(host + gsIndexMap.get(type));
51
52
 
52
53
  const $ = load(response.data);
@@ -13,15 +13,40 @@ import { domain, processMeta, getMeta, processItems } from './util';
13
13
 
14
14
  export const route: Route = {
15
15
  path: '/news/:category{.+}?',
16
- name: 'Unknown',
16
+ categories: ['university'],
17
+ example: '/whu/news',
18
+ parameters: { category: '新闻栏目,可选' },
19
+ name: '新闻网',
17
20
  maintainers: [],
18
21
  handler,
22
+ description: `
23
+ category 参数可选,范围如下:
24
+
25
+ | 新闻栏目 | 武大资讯 | 学术动态 | 珞珈影像 | 武大视频 |
26
+ | -------- | -------- | -------- | -------- | -------- |
27
+ | 参数 | 0 或 \`wdzx/wdyw\` | 1 或 \`kydt\` | 2 或 \`stkj/ljyx\` | 3 或 \`stkj/wdsp\` |
28
+
29
+ 此外 route 后可以加上 \`?limit=n\` 的查询参数,表示只获取前 n 条新闻;如果不指定默认为 10。
30
+ `,
31
+ };
32
+
33
+ const parseCategory = (category: string | number) => {
34
+ const outputs = ['wdzx/wdyw', 'kydt', 'stkj/ljyx', 'stkj/wdsp'];
35
+ if (['0', '1', '2', '3'].includes(category)) {
36
+ return outputs[category];
37
+ }
38
+ if (outputs.includes(category)) {
39
+ return category;
40
+ }
41
+ return 'wdzx/wdyw';
19
42
  };
20
43
 
21
44
  async function handler(ctx) {
22
- const { category = 'wdzx/wdyw' } = ctx.req.param();
45
+ let { category } = ctx.req.param();
23
46
  const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10;
24
47
 
48
+ category = parseCategory(category);
49
+
25
50
  const rootUrl = `https://news.${domain}`;
26
51
  const currentUrl = new URL(`${category}.htm`, rootUrl).href;
27
52
 
@@ -0,0 +1,54 @@
1
+ import type { Route, DataItem } from '@/types';
2
+ import cache from '@/utils/cache';
3
+ import ofetch from '@/utils/ofetch';
4
+ import { load } from 'cheerio';
5
+
6
+ export const route: Route = {
7
+ name: 'PAIR - AI Exploreables',
8
+ url: 'pair.withgoogle.com/explorables',
9
+ path: '/explorables',
10
+ maintainers: ['cesaryuan'],
11
+ example: '/withgoogle/explorables',
12
+ categories: ['blog'],
13
+ radar: [
14
+ {
15
+ source: ['pair.withgoogle.com/explorables'],
16
+ target: '',
17
+ },
18
+ ],
19
+ handler: async () => {
20
+ const baseUrl = 'https://pair.withgoogle.com';
21
+ const response = await ofetch(baseUrl + '/explorables', {
22
+ method: 'GET',
23
+ });
24
+ const $ = load(response);
25
+ const items = await Promise.all(
26
+ $('div.explorable-card')
27
+ .map(async (_, el) => {
28
+ const title = $(el).find('h3').text();
29
+ const image = $(el).find('img').attr('src');
30
+ const link = baseUrl + $(el).find('a').attr('href');
31
+ return (await cache.tryGet(link, async () => {
32
+ const response = await ofetch(link);
33
+ const $item = load(response);
34
+ let description = $item('body').html();
35
+ if (!description || description.trim() === '') {
36
+ description = $('p').text();
37
+ }
38
+ return {
39
+ title,
40
+ link,
41
+ description,
42
+ image,
43
+ };
44
+ })) as DataItem;
45
+ })
46
+ .toArray()
47
+ );
48
+ return {
49
+ title: 'PAIR - AI Exploreables',
50
+ link: 'https://pair.withgoogle.com/explorables',
51
+ item: items,
52
+ };
53
+ },
54
+ };
@@ -0,0 +1,6 @@
1
+ import type { Namespace } from '@/types';
2
+
3
+ export const namespace: Namespace = {
4
+ name: 'People + AI Research (PAIR)',
5
+ url: 'pair.withgoogle.com',
6
+ };
@@ -38,7 +38,7 @@ const parseList = async (
38
38
  }> => {
39
39
  const response = await got_ins.get(baseUrl + sectionUrl);
40
40
  const $ = load(response.data);
41
- let data = /realtime/.test(sectionUrl) ? $('.on-listing-pages') : $('.article-list').find('.article-type');
41
+ let data = /realtime/.test(sectionUrl) ? $('.card-listing .card') : $('.article-list').find('.article-type');
42
42
  if (data.length === 0) {
43
43
  // for HK version
44
44
  data = $('.clearfix').find('.list-block');
@@ -29,12 +29,19 @@ export const route: Route = {
29
29
 
30
30
  async function handler(ctx) {
31
31
  const id = ctx.req.param('id');
32
+ // 知乎专栏链接存在两种格式, 一种以 'zhuanlan.' 开头, 另一种新增的以 'c_' 结尾
33
+ let url = `https://zhuanlan.zhihu.com/${id}`;
34
+ if (id.search('c_') === 0) {
35
+ url = `https://www.zhihu.com/column/${id}`;
36
+ }
32
37
 
38
+ const signedHeader = await getSignedHeader(url, `https://www.zhihu.com/api/v4/columns/${id}/items`);
33
39
  const listRes = await got({
34
40
  method: 'get',
35
41
  url: `https://www.zhihu.com/api/v4/columns/${id}/items`,
36
42
  headers: {
37
43
  ...header,
44
+ ...signedHeader,
38
45
  Referer: `https://zhuanlan.zhihu.com/${id}`,
39
46
  },
40
47
  });
@@ -44,19 +51,13 @@ async function handler(ctx) {
44
51
  url: `https://www.zhihu.com/api/v4/columns/${id}/pinned-items`,
45
52
  headers: {
46
53
  ...header,
54
+ ...signedHeader,
47
55
  Referer: `https://zhuanlan.zhihu.com/${id}`,
48
56
  },
49
57
  });
50
58
 
51
59
  listRes.data.data = [...listRes.data.data, ...pinnedRes.data.data];
52
60
 
53
- // 知乎专栏链接存在两种格式, 一种以 'zhuanlan.' 开头, 另一种新增的以 'c_' 结尾
54
- let url = `https://zhuanlan.zhihu.com/${id}`;
55
- if (id.search('c_') === 0) {
56
- url = `https://www.zhihu.com/column/${id}`;
57
- }
58
-
59
- const signedHeader = await getSignedHeader(url, `https://www.zhihu.com/api/v4/columns/${id}/items`);
60
61
  const infoRes = await got(url, {
61
62
  headers: {
62
63
  ...signedHeader,
@@ -3,6 +3,7 @@ import { PrometheusExporter, PrometheusSerializer } from '@opentelemetry/exporte
3
3
  import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
4
4
  import { MeterProvider } from '@opentelemetry/sdk-metrics';
5
5
  import { Attributes } from '@opentelemetry/api';
6
+ import { config } from '@/config';
6
7
 
7
8
  interface IMetricAttributes extends Attributes {
8
9
  method: string;
@@ -33,12 +34,12 @@ const requestTotal = meter.createCounter<IMetricAttributes>(`${METRIC_PREFIX}_re
33
34
  const requestErrorTotal = meter.createCounter<IMetricAttributes>(`${METRIC_PREFIX}_request_error_total`);
34
35
  const requestDurationSecondsBucket = meter.createHistogram<IHistogramAttributes>(`${METRIC_PREFIX}_request_duration_seconds_bucket`, {
35
36
  advice: {
36
- explicitBucketBoundaries: [0.01, 0.1, 1, 2, 5, 15, 30, 60],
37
+ explicitBucketBoundaries: config.otel.seconds_bucket?.split(',').map(Number),
37
38
  },
38
39
  });
39
40
  const request_duration_milliseconds_bucket = meter.createHistogram<IHistogramAttributes>(`${METRIC_PREFIX}_request_duration_milliseconds_bucket`, {
40
41
  advice: {
41
- explicitBucketBoundaries: [10, 20, 50, 100, 250, 500, 1000, 5000, 15000],
42
+ explicitBucketBoundaries: config.otel.milliseconds_bucket?.split(',').map(Number),
42
43
  },
43
44
  });
44
45
 
package/lib/views/rss.tsx CHANGED
@@ -4,6 +4,7 @@ import { Data } from '@/types';
4
4
  const RSS: FC<{ data: Data }> = ({ data }) => {
5
5
  const hasItunes = data.itunes_author || data.itunes_category || (data.item && data.item.some((i) => i.itunes_item_image || i.itunes_duration));
6
6
  const hasMedia = data.item?.some((i) => i.media);
7
+ const isTelegramLink = data.link?.startsWith('https://t.me/s/');
7
8
 
8
9
  return (
9
10
  <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes={hasItunes ? 'http://www.itunes.com/dtds/podcast-1.0.dtd' : undefined} xmlns:media={hasMedia ? 'http://search.yahoo.com/mrss/' : undefined} version="2.0">
@@ -23,6 +24,12 @@ const RSS: FC<{ data: Data }> = ({ data }) => {
23
24
  <url>{data.image}</url>
24
25
  <title>{data.title || 'RSSHub'}</title>
25
26
  <link>{data.link}</link>
27
+ {isTelegramLink && (
28
+ <>
29
+ <height>31</height>
30
+ <width>88</width>
31
+ </>
32
+ )}
26
33
  </image>
27
34
  )}
28
35
  <lastBuildDate>{data.lastBuildDate}</lastBuildDate>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsshub",
3
- "version": "1.0.0-master.c183692",
3
+ "version": "1.0.0-master.c1913c8",
4
4
  "description": "Make RSS Great Again!",
5
5
  "keywords": [
6
6
  "RSS"
@@ -32,7 +32,7 @@
32
32
  "*.yml": "eslint --cache --fix"
33
33
  },
34
34
  "dependencies": {
35
- "@hono/node-server": "1.12.2",
35
+ "@hono/node-server": "1.13.0",
36
36
  "@hono/zod-openapi": "0.16.0",
37
37
  "@notionhq/client": "2.2.15",
38
38
  "@opentelemetry/api": "1.9.0",
@@ -44,14 +44,14 @@
44
44
  "@opentelemetry/semantic-conventions": "1.27.0",
45
45
  "@postlight/parser": "2.2.3",
46
46
  "@rss3/sdk": "0.0.17",
47
- "@scalar/hono-api-reference": "0.5.145",
47
+ "@scalar/hono-api-reference": "0.5.147",
48
48
  "@sentry/node": "7.116.0",
49
- "@tonyrl/rand-user-agent": "2.0.77",
49
+ "@tonyrl/rand-user-agent": "2.0.78",
50
50
  "aes-js": "3.1.2",
51
51
  "art-template": "4.13.2",
52
52
  "bbcodejs": "0.0.4",
53
53
  "cheerio": "1.0.0",
54
- "chrono-node": "2.7.6",
54
+ "chrono-node": "2.7.7",
55
55
  "city-timezones": "1.3.0",
56
56
  "cross-env": "7.0.3",
57
57
  "crypto-js": "4.2.0",
@@ -65,7 +65,7 @@
65
65
  "fanfou-sdk": "5.0.0",
66
66
  "form-data": "4.0.0",
67
67
  "googleapis": "144.0.0",
68
- "hono": "4.5.11",
68
+ "hono": "4.6.2",
69
69
  "html-to-text": "9.0.5",
70
70
  "http-cookie-agent": "6.0.5",
71
71
  "https-proxy-agent": "7.0.5",
@@ -102,13 +102,13 @@
102
102
  "simplecc-wasm": "1.0.0",
103
103
  "socks-proxy-agent": "8.0.4",
104
104
  "source-map": "0.7.4",
105
- "telegram": "2.24.11",
105
+ "telegram": "2.25.4",
106
106
  "tiny-async-pool": "2.1.0",
107
107
  "title": "3.5.3",
108
- "tldts": "6.1.44",
108
+ "tldts": "6.1.47",
109
109
  "tosource": "2.0.0-alpha.3",
110
110
  "tough-cookie": "4.1.4",
111
- "tsx": "4.19.0",
111
+ "tsx": "4.19.1",
112
112
  "twitter-api-v2": "1.17.2",
113
113
  "undici": "6.19.8",
114
114
  "uuid": "10.0.0",
@@ -139,29 +139,29 @@
139
139
  "@types/mailparser": "3.4.4",
140
140
  "@types/markdown-it": "14.1.2",
141
141
  "@types/module-alias": "2.0.4",
142
- "@types/node": "22.5.4",
142
+ "@types/node": "22.5.5",
143
143
  "@types/sanitize-html": "2.13.0",
144
144
  "@types/supertest": "6.0.2",
145
145
  "@types/tiny-async-pool": "2.0.3",
146
146
  "@types/title": "3.4.3",
147
147
  "@types/tough-cookie": "4.0.5",
148
148
  "@types/uuid": "10.0.0",
149
- "@typescript-eslint/eslint-plugin": "8.5.0",
150
- "@typescript-eslint/parser": "8.5.0",
149
+ "@typescript-eslint/eslint-plugin": "8.6.0",
150
+ "@typescript-eslint/parser": "8.6.0",
151
151
  "@vercel/nft": "0.27.4",
152
152
  "@vitest/coverage-v8": "2.0.5",
153
153
  "discord-api-types": "0.37.100",
154
154
  "eslint": "9.10.0",
155
155
  "eslint-config-prettier": "9.1.0",
156
156
  "eslint-nibble": "8.1.0",
157
- "eslint-plugin-n": "17.10.2",
157
+ "eslint-plugin-n": "17.10.3",
158
158
  "eslint-plugin-prettier": "5.2.1",
159
159
  "eslint-plugin-unicorn": "55.0.0",
160
160
  "eslint-plugin-yml": "1.14.0",
161
161
  "fs-extra": "11.2.0",
162
162
  "globals": "15.9.0",
163
163
  "got": "14.4.2",
164
- "husky": "9.1.5",
164
+ "husky": "9.1.6",
165
165
  "js-beautify": "1.15.1",
166
166
  "lint-staged": "15.2.10",
167
167
  "mockdate": "3.0.5",