📝 Overview
Douyin work real-time search tool, based on keywords calls the Redfox interface in real time to search for the latest Douyin works, returning real-time data (not cached/historical data). Supports filtering by sorting method and publish time.
✨ Features
| Function module | Capability description | Core value |
|---|---|---|
| Real-time search | Real-time keyword search for the latest Douyin works | Obtain non-cached real-time data |
| Multi-dimensional sorting | Supports three sorting types: comprehensive/latest/likes | Discover high-quality content by different dimensions |
| Time filtering | Supports 7 days/30 days/90 days/unlimited time range | Flexibly control the search time window |
| Smart expansion | Automatically generates 10 expanded terms when there are no results | Break through search bottlenecks and discover related content |
| Paginated browsing | Supports multiple-page result browsing | Explore large numbers of search results page by page |
| Subscription push | Supports daily keyword push | Scheduled access to the latest search results |
🔑 Authentication
Get API Key
Please go to Honghu hub to get the API KEY
Configure API Key
Option 1: Taking OpenClaw 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 user intent, extract keywords and filter parameters
⚠️ Core rule: semantic understanding takes priority, prioritize extracting niche direction terms rather than generalized broad category terms
1. Extract keywords
- Extract 2-6 character niche keywords from the user's description
- If the user's intent is vague (such as "help me search Douyin"), proactively ask: "Which 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 keywords
2. Identify filter parameters(use default values when the user does not specify)
- Sorting method(
--sort): default1(comprehensive sorting)- User mentions "latest", "recently published" →
2 - User mentions "likes", "popular", "hit" →
3 - No sorting mentioned →
1(default)
- User mentions "latest", "recently published" →
- Publish time(
--time): default7(last 7 days)- User mentions "last month", "30 days" →
30 - User mentions "last three months", "90 days" →
90 - User mentions "unlimited time", "all" →
0 - No time mentioned →
7(default)
- User mentions "last month", "30 days" →
- Page number(
--page): Default1- User mentions "next page", "page 2" → corresponding page number
- User mentions "previous page" → current page - 1
- No page number mentioned →
1(default)
Step 2: Call the real-time search script
python3 ~/.agents/skills/douyin-realtime-search/scripts/search_douyin_realtime.py "<关键词>" [--sort 排序] [--time 时间] [--page 页码]
Parameter description:
| Parameter | Optional values | Meaning |
|---|---|---|
| keyword | Any string | Search keywords, connect multiple words with English commas |
--sort |
1 / 2 / 3 |
Comprehensive sorting / Latest published / Most likes (default 1) |
--time |
7 / 30 / 90 / 0 |
Last 7 days / 30 days / 90 days / Unlimited (default 7) |
--page |
Positive integer | Page number, starting from 1 (default 1) |
The script outputs in JSON format:
| Field | Description |
|---|---|
articles |
List of works matching keywords (sorted by likes in descending order) |
latestHotArticles |
Recently popular recommended works (fallback display) |
hotTopics |
Related popular topic tags |
sort_type_label |
Text description of this sorting method |
publish_time_label |
Text description of this time range |
page |
Current page number |
has_next |
Whether there is a next page (true/false) |
Fields for each work:
| Field | Description |
|---|---|
title |
Work title |
author |
Author name |
like_count |
Like count |
comment_count |
Comment count |
share_count |
Share count |
collect_count |
Favorite count |
work_url |
Work link |
publish_time |
Publish time |
follower_count |
Follower count |
Step 3: Judge the results and display
Case A: articles count > 0 (has matching results)
A1. Inform the user of the query scope
📊 Keyword "XXX" real-time query found N itemsworks (sorting: {sort_type_label} | time range: {publish_time_label} | page {page}), the detailed data is as follows:
A2. Render Markdown table (display all)
| # | 作品标题 | 作者 | 点赞数 | 评论数 | 分享数 | 收藏数 |
| --- | -------------------- | ------ | ------ | ------ | ------ | ------ |
| 1 | [标题文字](作品链接) | 作者名 | 305.2w | 7.1w | 51.0w | 14.7w |
Number formatting rules:
< 10000: original number (e.g.320)≥ 10000:x.xwformat (e.g.1.2w)
Title rules: [标题](work_url); truncate if over 30 characters and add ...
A3. Filtering capability prompt (immediately after the table, must be output every time)
🔧 Filtering is supported. Reply with the following commands to switch conditions and search again:
- Sorting method: Comprehensive sorting / Latest published / Most likes (current: {sort_type_label})
- Publish time: Last 7 days / Last 30 days / Last 90 days / Unlimited (current: {publish_time_label})
Example: "Search again by latest published, last 30 days"
A4. Pagination prompt (⚠️ immediately after A3, 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 9 items or is empty, and it is already the last page):📄 Currently page {page} , there is no more data.
⚠️ A1~A4 are all indispensable and must be completed consecutively in the same round of output. After outputting A4, immediately follow with the Step 4 subscription prompt. If A4 is missing, it is considered an execution error and the output must be re-supplemented.
Case B: articles count = 0 (no matching results)
B1. Apology prompt + keyword expansion recommendations
😔 Sorry, no content directly related to「XXX」was found. You can try again with shorter or broader keywords (expansion word 1, expansion word 2, ... expansion word 10)
AI must generatefixed 10expansion words, 2~6 characters, separated by English commas, no fewer than 10.
B2. Filtering capability prompt (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, with no interruption.
Step 4: Subscription prompt
After all content is displayed,without waiting, end the output immediately, and only append the subscription prompt at the end:
📩 Would you like to subscribe to the daily push of「XXX」? After subscribing, the latest trending works will be automatically pushed every day at 10:00. Reply "Confirm Subscription" to create a scheduled task.
Step 5: Create a scheduled task (executed when the user replies "Confirm Subscription")
Prioritize 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 10:00 (cron:
0 10 * * *) - Execution content: run the script and display/push the results to the current conversation in the Step 3~4 format
General configuration solution:
# Linux/macOS crontab
0 10 * * * python3 ~/.agents/skills/douyin-realtime-search/scripts/search_douyin_realtime.py "<关键词>"
After successful creation, inform the user: "You have successfully subscribed to real-time work push for the keyword「<keyword>」. Every day at 10:00, the latest data will be automatically queried and notified to you."