📝 Introduction
Enter a keyword to search trending notes on Xiaohongshu, with multi-dimensional filtering by sort order, publish time, and note type. Note titles, authors, likes, comments, shares, and favorites are all shown at a glance, and a click on the link lets you jump to view details.
✨ Features
| Feature Module | Capability Description | Core Value |
|---|---|---|
| Keyword Search | Enter a keyword to search trending notes on Xiaohongshu | Precisely discover content in the target niche |
| Multi-dimensional Sorting | Comprehensive/Latest/Most Liked/Most Commented/Most Favorited | Discover high-quality content by different dimensions |
| Time Filtering | Unlimited/Within one day/Within one week/Within one month/Within one year | Flexibly control the search time window |
| Type Filtering | Unlimited/Video notes/Regular notes | Precisely filter by content format |
| Paginated Browsing | Display multiple results per page, with support for browsing multiple pages | Do not miss any piece of content |
| Subscription Push | Support daily push by keyword | Get the latest search results on a scheduled basis |
🎯 Target Users
- 🔍 Content Creators — Find trending notes in the same niche and study the topic direction and viral patterns of benchmark content.
- 📊 Operations / Data Analysis — Quickly understand what trending content a certain category has on Xiaohongshu and grasp traffic trends.
- 🏢 Brands / MCNs — Screen potential partner creators, evaluate note value by engagement volume, and support placement decisions.
- 🛒 E-commerce Product Selection — Search sales notes in niche tracks and find matching promotional content directions.
🔑 Authentication
Get API Key
Please go to Redfox Hub to get the API KEY
Configure API Key
Option 1: Taking Qoder as an example, add REDFOX_API_KEY to ~/.openclaw/openclaw.json :
{ "env": { "REDFOX_API_KEY": "ak_xxxx..." } }
Option 2: Terminal configuration
export REDFOX_API_KEY="ak_xxxx..."
🔄 Workflow
Step 1: Understand the user's intent and extract keywords and filter parameters
1. Extract keywords
- Extract a 2-6 character search keyword from the user's description
- If the user's intent is vague (such as "help me search Xiaohongshu"), proactively ask: "What direction or field of content would you like to search for?"
- Do not guess on your own and call the script when the user has not provided a keyword
2. Identify filter parameters(use default values when the user does not specify)
- Sort order(
--sort): default最多点赞- User mentions "comprehensive" →
综合 - User mentions "latest", "recent" →
最新, and the publish time is linked to不限, and the note type is不限 - User mentions "latest popular", "recently popular", "latest viral", "what's trending recently" →
最多点赞, and the publish time is linked to一周内 - User mentions "comments", "lots of discussion" →
最多评论 - User mentions "favorites" →
最多收藏 - No sorting mentioned →
最多点赞(default)
- User mentions "comprehensive" →
- Publish time(
--note-time): default一个月内- User mentions "one day", "today", "24 hours" →
一天内 - User mentions "one week", "seven days", "last 7 days" →
一周内 - User mentions "one month", "30 days" →
一个月内 - User mentions "one year", "whole year" →
一年内 - User mentions "no time limit", "all" →
不限 - No time mentioned →
一个月内(default)
- User mentions "one day", "today", "24 hours" →
- Note type(
--note-type): default不限- User mentions "video", "video note" →
视频笔记 - User mentions "image-text", "normal note", "image-text note" →
普通笔记 - No type mentioned →
不限(default)
- User mentions "video", "video note" →
- Page number(
--page): default1- User mentions "next page", "page 2" → corresponding page number
- No page number mentioned →
1(default)
Step 2: Call the search script
python3 ~/.agents/skills/xiaohongshu-realtime-search/scripts/search_xhs_work.py "<关键词>" [--sort 排序] [--note-time 时间] [--note-type 类型] [--page 页码]
Parameter description:
| Parameter | Optional values | Meaning |
|---|---|---|
| keyword | Any string | Search keyword |
--sort |
综合 / 最新 / 最多点赞 / 最多评论 / 最多收藏 |
Sorting method (default: most likes) |
--note-time |
不限 / 一天内 / 一周内 / 一个月内 / 一年内 |
Publish time range (default: within one month) |
--note-type |
不限 / 视频笔记 / 普通笔记 |
Note type filter (default: unlimited) |
--page |
Positive integer | Page number, starting from 1 (default: 1) |
The script outputs in JSON format:
| Field | Description |
|---|---|
articles |
Keyword-matched works list (arranged according to the requested sorting parameter) |
sort_label |
Text description of the sorting method for this request |
note_time_label |
Text description of the time range for this request |
note_type_label |
Text description of the note type for this request |
page |
Current page number |
has_next |
Whether there is a next page (true/false) |
total |
Total count |
Fields for each work:
| Field | Description |
|---|---|
title |
Note title |
author |
Author name |
author_url |
Author homepage link |
like_count |
Like count |
comment_count |
Comment count |
share_count |
Share count |
collect_count |
Favorite count |
work_url |
Work link |
publish_time |
Publish time (YYYY-MM-DD HH:MM) |
publish_date |
Publish date (YYYY-MM-DD) |
follower_count |
Follower count |
Step 3: Judge the result and display it
Case A: articles count > 0 (matching results found)
A1. Inform the user of the query scope
📊 Keyword "XXX" found N itemsnotes (sorting: {sort_label} | time range: {note_time_label} | note type: {note_type_label} | page {page}), the detailed data is as follows:
A2. Link risk control notice (immediately after A1, must be output every time)
⚠️ Due to Xiaohongshu risk control rules, some post links may not redirect properly. You can copy the corresponding post title and search for it on Xiaohongshu to view it. Thank you for your understanding🙇♀️🙇♀️
A3. Render Markdown table (⚠️ must be output item by item, the number of items must match N in A1, not one item missing)
| # | 笔记标题 | 作者 | 发布时间 | 点赞数 | 评论数 | 收藏数 |
|---|---------|------|---------|--------|--------|--------|
| 1 | [标题文字](作品链接) | [作者名](作者主页链接) | 2026-06-30 | 1.2w | 305 | 8.7w |
Number formatting rules:
< 10000: raw number (e.g.320)≥ 10000:x.xwformat (e.g.1.2w)
Title rules: [标题](work_url); the title must be displayed in full and must never be truncated; when the title is empty, display -; the | character in the title has been automatically escaped by the script as \|, to avoid breaking the table column separators
Author rules: [作者名](author_url); the author name must be displayed in full; if author_url is empty, display the author name as plain text
A4. Filtering capability notice (immediately after the table, must be output every time)
🔧 Filtering is supported. Reply with the following commands to switch conditions and search again:
- Sort order: Comprehensive sorting / Latest published / Most liked / Most commented / Most saved (current: {sort_label})
- Publish time:不限 / Within one day / Within one week / Within one month / Within one year (current: {note_time_label})
- Note type: Unlimited / Video note / Regular note (current: {note_type_label})
Example: "Search again by Latest published, Within one week, Video note"
A5. Pagination notice (⚠️ immediately after A4, cannot be omitted, must be output every time)
- If
has_nextis true:
📄 Currently page {page} . Reply "Next page" to continue viewing.
- If
has_nextis false (the current page has fewer than 20 items or is empty, and it is already the last page):
📄 Currently page {page} , there is no more data.
⚠️ A1~A5 are all indispensable and must be completed consecutively in the same round of output. After outputting A5, immediately follow with the Step 4 subscription prompt.
Case B: articles count = 0 (no matching results)
B1. Apology prompt + adjustment suggestions
😔 Sorry, no Xiaohongshu notes related to "XXX" were found. 💡 Suggestions to try: change to a shorter or broader keyword, expand the time range, or switch the note type.
B2. Filtering capability notice (immediately after B1, must be output every time, format same as A3)
⚠️ B1~B2 must be completed consecutively in the same round of output. After outputting B2, immediately follow with the Step 4 subscription prompt.
Step 4: Subscription prompt
After all content has been displayed,do not wait and end the output immediately, only attach the subscription prompt at the end:
📩 Would you like to subscribe to the daily push for "XXX"? After subscribing, the latest works will be automatically pushed every day at 09:00. Reply "Confirm subscription" to create a scheduled task.
Step 5: Create scheduled task (executed when the user replies "Confirm subscription")
Prefer using the platform's built-in scheduled task capability; if unavailable, provide a general solution:
Platform built-in scheduled task (preferred):
- Task name:
小红书最新热门笔记订阅 - <关键词> - Execution frequency: every day at 09:00 (cron:
0 9 * * *) - Execution content: run the script and push the results to the current conversation in the Step 3~4 format
General configuration plan:
# Linux/macOS crontab
0 9 * * * python3 ~/.agents/skills/xiaohongshu-realtime-search/scripts/search_xhs_work.py "<关键词>"
After successful creation, notify the user: "You have successfully subscribed to Xiaohongshu post pushes for the keyword '<keyword>'. Every day at 09:00, the latest data will be automatically queried and you will be notified."