跳转到项目内容
研究方法 · Skill · 站内全文

数据样本与导出方法

TikHub · 多平台研究方法 · English · 原始日期未注明

原作者研究方法,English。文内工具与接口按原文保留;本页供研读,实际使用的依赖见参考文件。

本资料包的参考文件(5)
本页目录

Bulk Data Export

Paginate a list endpoint at scale, dedup, and write a clean dataset — safely and with a cost estimate up front.

Setup gate

[ -z "${TIKHUB_API_KEY:-}" ] && echo "Set TIKHUB_API_KEY first (see tikhub-onboarding)."

Step 1 — Estimate cost FIRST (mandatory)

Bulk pulls are the biggest credit spender. Before fetching:

# pages = ceil(target_rows / page_size)
curl -s "https://api.tikhub.io/api/v1/tikhub/user/calculate_price?endpoint=<ENDPOINT_PATH>&request_per_day=" \
  -H "Authorization: Bearer $TIKHUB_API_KEY"
curl -s "https://api.tikhub.io/api/v1/tikhub/user/get_user_daily_usage" -H "Authorization: Bearer $TIKHUB_API_KEY"

State the estimated calls + cost and get the user's go-ahead before running.

Step 2 — Paginate safely

  • Use the platform's cursor (max_cursor / pagination_token / continuation_token / cursor / cursor+index) — see tikhub-rest-api and the platform skill.
  • Loop until has_more is false or the user's target row count is reached (hard cap).
  • Add a short delay / concurrency cap ≤4 (QPS 10/sec). Retry transient 429/5xx with backoff.
  • Dedup by stable id (e.g. aweme_id / post id) as you go.

Step 3 — Export

  • JSON: write the deduped array to output.json.
  • CSV: flatten the fields the user cares about (id, author, text, likes, comments, shares, timestamp, url) into output.csv.
  • Report row count, pages fetched, duplicates removed, and the file path.

Verification gate

  1. Row count ≈ requested (note if the source ran out early).
  2. No duplicate ids in the output.
  3. File written and non-empty; CSV header matches columns.

Red flags

  • Skipping the cost estimate — never start a bulk pull without one.
  • Ignoring the user's row cap / has_more (infinite loop, credit burn).
  • Silent truncation — always report how many rows were actually fetched vs. requested.
资料信息
资料提供方
TikHub
采用方式
站内全文
核查日期
2026-10-24
版本
755a540afa53dbc31993cb7567376db0ea0fca4f
许可
MIT
原资料入口 ↗
← 返回专题研究
抖音运营基地 · 学习与研究按资料原有时间与适用条件研读。
网站更新 · 持续记录

通知公告

联系我们

博主藏经阁

联系我们