Skip to content

Commit

Permalink
fix: 修复小红书
Browse files Browse the repository at this point in the history
  • Loading branch information
yllhwa committed Mar 19, 2024
1 parent 53997e6 commit 0d32498
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/lib/xiaohongshu/user.js
Original file line number Diff line number Diff line change
@@ -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', {
Expand Down

0 comments on commit 0d32498

Please sign in to comment.