Skip to content

Conversation

@DIYgod
Copy link
Owner

@DIYgod DIYgod commented Jan 22, 2026

Summary

Allow xiaohongshu routes to bypass anti-scraping by routing requests through a configurable proxy. When XIAOHONGSHU_PROXY environment variable is set, all xiaohongshu HTTP requests will use the proxy endpoint instead of Puppeteer.

Implementation

  • Added proxy configuration option to xiaohongshu config
  • Created fetchWithProxy helper that uses proxy when available
  • Modified getUser, getBoard, getFullNote, and getUserWithCookie to use proxy
  • Added extractInitialSsrState helper for board page parsing

Routes

NOROUTE

Co-Authored-By: Claude Haiku 4.5 [email protected]

Allow xiaohongshu routes to bypass anti-scraping measures by routing requests through a configurable proxy. When XIAOHONGSHU_PROXY is set, all xiaohongshu HTTP requests (user, board, notes) will be routed through the proxy endpoint instead of using Puppeteer.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@DIYgod DIYgod merged commit c90e71c into master Jan 22, 2026
41 of 44 checks passed
@DIYgod DIYgod deleted the DIYgod/xhs-proxy-config branch January 22, 2026 09:17
@github-actions github-actions bot added the route label Jan 22, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3cc81503ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +33 to +38
async function fetchWithProxy(url: string, cookie?: string): Promise<string> {
const proxy = config.xiaohongshu.proxy;
if (proxy) {
const proxyUrl = `${proxy}?url=${encodeURIComponent(url)}`;
logger.http(`Requesting ${url} via proxy`);
return await ofetch(proxyUrl, { parseResponse: (txt) => txt });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Forward cookie when proxy is enabled

When XIAOHONGSHU_PROXY is set, fetchWithProxy ignores the cookie parameter and sends no headers to the proxy. That means any route that relies on XIAOHONGSHU_COOKIE (e.g., getUserWithCookie and getFullNote) will silently lose authentication when a proxy is configured, often returning a login page or incomplete data that then fails JSON.parse/data extraction. If the proxy is expected to access logged-in content, it needs the cookie forwarded (e.g., as a header or query parameter).

Useful? React with 👍 / 👎.

xbot pushed a commit to xbot/RSSHub that referenced this pull request Jan 22, 2026
Allow xiaohongshu routes to bypass anti-scraping measures by routing requests through a configurable proxy. When XIAOHONGSHU_PROXY is set, all xiaohongshu HTTP requests (user, board, notes) will be routed through the proxy endpoint instead of using Puppeteer.

Co-authored-by: Claude Haiku 4.5 <[email protected]>
smart-z pushed a commit to smart-z/RSSHub that referenced this pull request Jan 23, 2026
Allow xiaohongshu routes to bypass anti-scraping measures by routing requests through a configurable proxy. When XIAOHONGSHU_PROXY is set, all xiaohongshu HTTP requests (user, board, notes) will be routed through the proxy endpoint instead of using Puppeteer.

Co-authored-by: Claude Haiku 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants