From fad0dfa7dc679a9dc2258b9878aa996eac5bec07 Mon Sep 17 00:00:00 2001
From: CaoMeiYouRen <40430746+CaoMeiYouRen@users.noreply.github.com>
Date: Tue, 20 May 2025 22:05:28 +0800
Subject: [PATCH] =?UTF-8?q?fix(xiaohongshu):=20=E4=BF=AE=E5=A4=8D=E5=B0=8F?=
=?UTF-8?q?=E7=BA=A2=E4=B9=A6=20title/updated=20=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E5=9C=A8=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E7=BC=BA?=
=?UTF-8?q?=E5=A4=B1=20(#19135)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/routes/xiaohongshu/util.ts | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/routes/xiaohongshu/util.ts b/lib/routes/xiaohongshu/util.ts
index b166ee503..519ea9618 100644
--- a/lib/routes/xiaohongshu/util.ts
+++ b/lib/routes/xiaohongshu/util.ts
@@ -126,11 +126,12 @@ async function renderNotesFulltext(notes, urlPrex, displayLivePhoto) {
author: string;
guid: string;
pubDate: Date;
+ updated: Date;
}> = [];
const promises = notes.flatMap((note) =>
note.map(async ({ noteCard, id }) => {
const link = `${urlPrex}/${id}`;
- const { title, description, pubDate } = await getFullNote(link, displayLivePhoto);
+ const { title, description, pubDate, updated } = await getFullNote(link, displayLivePhoto);
return {
title,
link,
@@ -138,6 +139,7 @@ async function renderNotesFulltext(notes, urlPrex, displayLivePhoto) {
author: noteCard.user.nickName,
guid: noteCard.noteId,
pubDate,
+ updated,
};
})
);
@@ -159,7 +161,8 @@ async function getFullNote(link, displayLivePhoto) {
desc = desc.replaceAll(/\[.*?\]/g, '');
desc = desc.replaceAll(/#(.*?)#/g, '#$1');
desc = desc.replaceAll('\n', '
');
- const pubDate = new Date(note.time);
+ const pubDate = parseDate(note.time, 'x');
+ const updated = parseDate(note.lastUpdateTime, 'x');
let mediaContent = '';
if (note.type === 'video') {
@@ -223,11 +226,12 @@ async function getFullNote(link, displayLivePhoto) {
const description = `${mediaContent}
${title}
${desc}`;
return {
- title,
+ title: title || note.desc,
description,
pubDate,
+ updated,
};
- })) as Promise<{ title: string; description: string; pubDate: Date }>;
+ })) as Promise<{ title: string; description: string; pubDate: Date; updated: Date }>;
return data;
}