SuperAPI AI Directory

douyin-comment

General & other

View repository

Updated 10-16 04:56

About this skill

Douyin Comment Fetching (Dubaoya)

This duck specializes incomment section data retrievalThis tier: give a Douyin work ID, and fetch the first-level comments under that work page by page, laying them out directly as a table in the terminal—for you to dopublic opinion judgment/topic insightwith. The comment section is a gold mine of users' real needs: what they're asking, complaining about, and requesting—the next topic is often hidden in there.

Data goes through doubaoya.com one line, authentication uses your own key (environment variable DOUBAOYA_API_KEY, in the form dyh_…)。

Don't have a work ID yet? First use douyin-search(by keyword) or douyin-realtime-search(real-time comprehensive) to search for the target work, get the videoId(work ID), then come back to this duck to scrape comments.


Applicable scenarios

Scenario How to use What you get
Public opinion trend monitoring Scrape the comment section of a viral work Quickly judge whether viewers are praising or criticizing, and which way the trend leans
Dig into users' real needs Flip through a few pages of comments to see high-frequency questions Grasp the question the next topic should answer
Benchmark work breakdown See what comments under a benchmark viral work are discussing Figure out what really strikes viewers
Controversy/crisis warning Watch comments on brand-related works Spot negative signs at the first moment
Topic inspiration gathering Fish out golden lines/pain points from high-like comments Gather first-hand real material for the next script

Workflow (4 steps)

1. Get the work videoId

This duck fetches comments bywork ID, and does not recognize URLs. If you only have a work link or keyword, first use douyin-search / douyin-realtime-search to search for the target work, and take the videoId(work ID) from the results. Scrape only one work at a time.

2. Call the comment script (pageable)

python3 "$SKILL_PATH/scripts/fetch_comments.py" "7480000000000000000"

Page further down:

python3 "$SKILL_PATH/scripts/fetch_comments.py" "7480000000000000000" --page 2

The script prints the data from the success envelope to stdout as JSON.Run the script only once per page, read the complete stdout directly, don't use head/tail to preview, and don't call it repeatedly.

3. Lay out as a comment table

From data.items(comment array), take the fields and lay them out as Markdown according to the table below. Dodefensive reading——text(comment content) / likeCount(likes) / authorName(author) / ipLocation(IP location, if any) may be missing; if missing, leave blank and don't error.

Comment content Likes Author IP location
Example comment in one sentence 1.2w Some user Guangdong

Want to sort the comments, by likes (likeCount) Sort descending, highest likes first—highly liked comments best represent audience consensus and are the strongest signals for topic selection. This is presentation-layer processing and does not change the API call.

4. Provide a public opinion/topic insight

After the table, add a sentence in this duck's voicePublic opinion/topic insight: whether the comment section is overall praise or criticism, what the high-frequency pain points are, and whether there are ready-made topic hooks to pick up. Keep it short and useful; don't pile on clichés, and don't ask the user back "what is your real purpose".

If you see in the response that hasMore is true, it meansthere is another page—if you want to see it all, --page add one and keep pulling; if it is false , then you have reached the end.


Get the key (secret key)

  1. Open doubaoya.com
  2. Log in
  3. Go to Key Center
  4. Generate key(in the form dyh_…)

Put it into the environment variable (the script only recognizes this one):

export DOUBAOYA_API_KEY="dyh_你的密钥"

Iron rule: the key must never be printed, never written to a file, and never echoed back to the user. The script itself also never outputs the key. All requests are sent only to doubaoya.com, and do not take the key to any other domain.


API and envelope

  • POST https://doubaoya.com/api/apis/douyin/comments/call
  • Auth header:Authorization: Bearer $DOUBAOYA_API_KEY
  • Request body:{ "videoId": "7480000000000000000", "page": 1 }
    • videoId: string, required (work ID)
    • page: integer, optional (default 1; paginate to fetch the next batch of comments)
  • Response envelope:
    {
      "success": true,
      "requestId": "...",
      "data": { "items": [ { "text": "...", "likeCount": 0, "authorName": "...", "ipLocation": "..." } ], "hasMore": true },
      "error": null
    }
    
  • First check success: only if it is true should you read data; otherwise read error.code / error.message。
  • data.hasMore being true indicates there is another page of comments, and you can --page add one and keep pulling.

Error handling

When the script fails, it prints to stderr [error] CODE: message and exits with exit code 1. Common cases:

HTTP code Meaning Handling
401 MISSING_API_KEY / UNAUTHORIZED No key provided or invalid key Check DOUBAOYA_API_KEY, go to the Key Center to regenerate
400 VALIDATION_ERROR Invalid parameter (such as empty videoId) Correct the work ID and retry
402 INSUFFICIENT_CREDITS Insufficient quota Go to doubaoya.com to top up/renew quota
502 PROVIDER_FAILED Temporary upstream failure (automatically refunded) safe to retry

502 PROVIDER_FAILED will automatically refund; retrying is safe and will not double-charge.


Directory structure

douyin-comment/
├── SKILL.md                  # 本文件
└── scripts/
    └── fetch_comments.py     # 零依赖评论拉取脚本(urllib),调用 doubaoya.com

About the notice field in the response

After calling the doubaoya API corresponding to this skill, if the returned JSON has a top-level notice field, please relay this sentence to the user verbatim—this is a notice that this skill has an update, it does not affect the result of this call, and no retry or behavior change is needed.