From d939534f72ed21a7db8440a8b3245a960ca6f623 Mon Sep 17 00:00:00 2001 From: runny4184 Date: Sun, 26 Apr 2026 16:58:16 +0000 Subject: [PATCH 1/2] Update user.ts --- lib/routes/xiaohongshu/user.ts | 53 +++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/lib/routes/xiaohongshu/user.ts b/lib/routes/xiaohongshu/user.ts index 5cc0d88f6009..2607282826bd 100644 --- a/lib/routes/xiaohongshu/user.ts +++ b/lib/routes/xiaohongshu/user.ts @@ -6,9 +6,7 @@ import type { Route } from '@/types'; import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { fallback, queryToBoolean } from '@/utils/readable-social'; - -import { getUser, getUserWithCookie, renderNotesFulltext } from './util'; - +import { getFullNote, getUser, getUserWithCookie, renderNotesFulltext } from './util'; export const route: Route = { path: '/user/:user_id/:category/:routeParams?', name: '用户笔记/收藏', @@ -97,18 +95,39 @@ async function getUserFeeds(url: string, category: string) { const description = `${basicInfo.desc} ${tags.map((t) => t.name).join(' ')} ${interactions.map((i) => `${i.count} ${i.name}`).join(' ')}`; const image = basicInfo.imageb || basicInfo.images; - const renderNote = (notes) => - notes.flatMap((n) => - n.map(({ id, noteCard }) => ({ - title: noteCard.displayTitle, - link: new URL(noteCard.noteId || id, url).toString(), - guid: noteCard.displayTitle, - description: `
${noteCard.displayTitle}`, - author: noteCard.user.nickname, - upvotes: noteCard.interactInfo.likedCount, - })) - ); - const renderCollect = (collect) => { + const urlNotePrefix = 'https://www.xiaohongshu.com/explore'; + const renderNote = async (notes) => { + const promises = notes.flatMap((n) => + n.map(async ({ id, noteCard }) => { + const link = `${urlNotePrefix}/${id}`; + try { + const { title, description, pubDate, updated } = await getFullNote(link, false); + return { + title, + link, + description, + author: noteCard.user.nickname, + guid: `${urlNotePrefix}/${noteCard.noteId}`, + pubDate, + updated, + upvotes: noteCard.interactInfo.likedCount, + }; + } catch { + // Fallback to basic rendering if full fetch fails + return { + title: noteCard.displayTitle, + link, + guid: noteCard.displayTitle, + description: `
${noteCard.displayTitle}`, + author: noteCard.user.nickname, + upvotes: noteCard.interactInfo.likedCount, + }; + } + }) + ); + return Promise.all(promises); + }; +const renderCollect = (collect) => { if (!collect) { throw new InvalidParameterError('该用户已设置收藏内容不可见'); } @@ -120,7 +139,7 @@ async function getUserFeeds(url: string, category: string) { } return collect.data.notes.map((item) => ({ title: item.display_title, - link: `${url}/${item.note_id}`, + link: `https://www.xiaohongshu.com/explore/${item.note_id}`, description: `
${item.display_title}`, author: item.user.nickname, upvotes: item.interact_info.likedCount, @@ -132,6 +151,6 @@ async function getUserFeeds(url: string, category: string) { description, image, link: url, - item: category === 'notes' ? renderNote(notes) : renderCollect(collect), + item: category === 'notes' ? await renderNote(notes) : renderCollect(collect), }; } From 5f725b8d5ac3ffa0e424c526586cadc8064ee252 Mon Sep 17 00:00:00 2001 From: runny4184 Date: Mon, 27 Apr 2026 12:49:14 +0000 Subject: [PATCH 2/2] Update user.ts --- lib/routes/xiaohongshu/user.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/routes/xiaohongshu/user.ts b/lib/routes/xiaohongshu/user.ts index 2607282826bd..441ac1a1863c 100644 --- a/lib/routes/xiaohongshu/user.ts +++ b/lib/routes/xiaohongshu/user.ts @@ -7,6 +7,7 @@ import { ViewType } from '@/types'; import cache from '@/utils/cache'; import { fallback, queryToBoolean } from '@/utils/readable-social'; import { getFullNote, getUser, getUserWithCookie, renderNotesFulltext } from './util'; + export const route: Route = { path: '/user/:user_id/:category/:routeParams?', name: '用户笔记/收藏', @@ -96,7 +97,7 @@ async function getUserFeeds(url: string, category: string) { const image = basicInfo.imageb || basicInfo.images; const urlNotePrefix = 'https://www.xiaohongshu.com/explore'; - const renderNote = async (notes) => { + const renderNote = (notes) => { const promises = notes.flatMap((n) => n.map(async ({ id, noteCard }) => { const link = `${urlNotePrefix}/${id}`; @@ -151,6 +152,6 @@ const renderCollect = (collect) => { description, image, link: url, - item: category === 'notes' ? await renderNote(notes) : renderCollect(collect), + item: category === 'notes' ? renderNote(notes) : renderCollect(collect), }; }