From 0d324989a72c400404e3ea775a6456c5583aa965 Mon Sep 17 00:00:00 2001 From: yllhwa Date: Tue, 19 Mar 2024 16:39:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=BA=A2?= =?UTF-8?q?=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ src/lib/xiaohongshu/user.js | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 272710c..694ea4b 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ RSSWorker 是一个轻量级的 RSS 订阅工具,可以部署在 Cloudflare Wo - weibo 用户 (/weibo/user/:uid) - 小红书用户 (/xiaohongshu/user/:uid) +> 小红书更新后不能再使用小红书号,需要使用小红书用户ID。 +> 获取方法: +> 移动端:用户页面 > 右上角三个点 > 复制链接 > 获取链接中的用户ID +> 网页端:用户页面 > 链接中的用户ID +> 格式:https://www.xiaohongshu.com/user/profile/5d2aec020000000012037401 + ## 部署 [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/yllhwa/RSSWorker) diff --git a/src/lib/xiaohongshu/user.js b/src/lib/xiaohongshu/user.js index f0c9b54..b661992 100644 --- a/src/lib/xiaohongshu/user.js +++ b/src/lib/xiaohongshu/user.js @@ -1,7 +1,11 @@ import { renderRss2 } from '../../utils/util'; let getUser = async (url) => { - let res = await fetch(url); + let res = await fetch(url, { + headers: { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36", + } + }); let scripts = []; let rewriter = new HTMLRewriter() .on('script', {