Threads API:貼文搜尋、回覆與 reactions 任務
依 2026-10-25 規格快照
快速解答
Threads API 有四種非同步任務:關鍵字搜尋、單則貼文的回覆(pushs)、公開帳號的貼文時間軸,以及貼文的 reactions。reactions 任務成功完成後,輪詢回應直接帶回 reactions 清單與分頁;搜尋、回覆與時間軸任務的輪詢只回傳狀態與計數,結果的取回方式(透過搜尋端點或專案資料集)於開通時依帳號確認。各端點可用 mask_author 移除作者身分欄位。資料以網路爬蟲蒐集 Threads 公開發布的內容。
可取得的資料
欄位依 2026-10-25 規格快照。快照沒有逐一列出搜尋結果貼文的欄位,標示「示意樣本」的列取自下方示意資料,正式欄位以試用資料為準。快照也未將 post_id、parent_id 等關聯欄位標為必填,實際出現情形請以試用資料確認。
| 資料 | 欄位 | 端點 |
|---|---|---|
| 搜尋任務狀態 | id, status, completed, total, failed_articles, failed_pages, partial, timed_out, created_at, keyword, account_username | GET /threads/search/task/{task_id} |
| 回覆任務狀態 | id, status, completed, total, failed_articles, failed_pages, partial, timed_out, created_at, post_url | GET /threads/pushs/task/{task_id} |
| 公開帳號的貼文時間軸任務狀態 | id, status, completed, total, failed_articles, failed_pages, partial, timed_out, created_at, author_id | GET /threads/users/task/{task_id} |
| 貼文 reactions | data, pagination, error_message, task.post_id, task.post_url, task.status, task.warnings | GET /threads/reactions/task/{task_id} |
| 結果紀錄(示意樣本,取回方式開通時確認) | id, url, author, content, tm, like_count, comment_count, share_count, reply_count, is_reply, is_quote, reply_to_author | 開通時確認 |
端點一覽
Base URL 為 https://api.infominer.io/api/v2,每個請求以 auth-header 標頭帶 API 金鑰。主要參數中標示 * 者為必填。
| 方法 | 路徑 | 說明 | 主要參數 |
|---|---|---|---|
| POST | /threads/search/task |
建立關鍵字搜尋任務,可加帳號名稱、日期區間、max_scroll 與 rerun。 | keyword* account_username end_date mask_author max_scroll rerun start_date |
| GET | /threads/search/task/{task_id} |
輪詢搜尋任務,回傳狀態與 completed、total、failed_articles、failed_pages 計數,不含結果資料。 | task_id* mask_author |
| POST | /threads/pushs/task |
以貼文網址建立回覆蒐集任務。 | post_url* mask_author max_scroll rerun |
| GET | /threads/pushs/task/{task_id} |
輪詢回覆任務,回傳狀態與計數,不含回覆資料。 | task_id* mask_author |
| POST | /threads/users/task |
建立公開帳號的貼文時間軸任務,可加日期區間。 | author_id* end_date mask_author max_scroll rerun start_date |
| GET | /threads/users/task/{task_id} |
輪詢時間軸任務,回傳狀態與計數,不含貼文資料。 | task_id* mask_author |
| POST | /threads/reactions/task |
以貼文網址建立 reactions 蒐集任務,rerun 預設為 true。 | post_url* mask_author rerun |
| GET | /threads/reactions/task/{task_id} |
輪詢 reactions 任務;成功完成時回傳 reactions 清單與分頁。 | task_id* page per_page mask_author |
取資料流程
- POST /threads/search/task 帶 keyword(必填),可選 account_username、start_date、end_date(含當日)、max_scroll(不可為負數)、rerun。
- GET /threads/search/task/{task_id} 輪詢狀態:INIT、RUNNING、DONE、PARTIAL、TIMED_OUT 或 FAILED,並回報 completed、total、failed_articles、failed_pages。
- 要看一則貼文的回覆時,POST /threads/pushs/task 帶 post_url;要看 reactions 時,POST /threads/reactions/task 帶 post_url(rerun 預設為 true,重送同一個網址會建立新任務)。
- reactions 任務在 DONE 且非 partial、非 timed_out 時,GET /threads/reactions/task/{task_id} 回傳 data 與 pagination,per_page 最多 1000;若任務成功但清單取不到,回應帶 error_message。
- 搜尋、回覆與時間軸任務完成後,結果不在輪詢回應中;取回方式(透過搜尋端點或專案資料集)於開通時依帳號確認。
curl 範例
建立關鍵字搜尋任務
curl -X POST https://api.infominer.io/api/v2/threads/search/task \
-H "auth-header: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"keyword": "登山步道", "start_date": "2026-06-01", "end_date": "2026-06-30", "max_scroll": 5, "mask_author": false}'
以任務 ID 輪詢
curl "https://api.infominer.io/api/v2/threads/search/task/$TASK_ID" \
-H "auth-header: YOUR_API_KEY"
建立 reactions 任務並遮蔽作者欄位
curl -X POST https://api.infominer.io/api/v2/threads/reactions/task \
-H "auth-header: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"post_url": "https://www.threads.com/@sample_user_1/post/SAMPLE000001", "mask_author": true}'
示意 JSON 樣本
以下為人工撰寫的示意資料:帳號為 sample_user_n,ID 為明顯的假值,不是真實貼文。
建立任務的回應(示意資料)
{
"id": "00000000-0000-4000-8000-000000000001",
"keyword": "登山步道",
"status": "INIT",
"start_date": "2026-06-01",
"end_date": "2026-06-30",
"max_scroll": 5,
"rerun": false,
"partial": false,
"timed_out": false,
"completed": null,
"total": null,
"failed_articles": 0,
"failed_pages": 0,
"created_at": 1781056800
}
結果紀錄(示意資料,非輪詢回應)
{
"total_count": 2,
"data": [
{
"id": "00000000-0000-4000-8000-0000000000a1",
"source": "threads",
"url": "https://www.threads.com/@sample_user_1/post/SAMPLE000001",
"author": "sample_user_1",
"title": "",
"content": "週末走了一條不太熱門的步道,沿途視野很開闊,建議早點出發避開人潮",
"tm": 1781056800,
"sentiment": "Positive",
"like_count": 34,
"comment_count": 4,
"share_count": 1,
"reply_count": 4,
"is_reply": false,
"is_quote": false,
"reply_to_author": "",
"search_type": "keyword",
"tag": "",
"tag_id": ""
},
{
"id": "00000000-0000-4000-8000-0000000000a2",
"source": "threads",
"url": "https://www.threads.com/@sample_user_2/post/SAMPLE000002",
"author": "sample_user_2",
"title": "",
"content": "請問這條步道雨天好走嗎?下週想安排家人一起去",
"tm": 1781060400,
"sentiment": "Neutral",
"like_count": 3,
"comment_count": 1,
"share_count": 0,
"reply_count": 1,
"is_reply": true,
"is_quote": false,
"reply_to_author": "sample_user_1",
"search_type": "keyword",
"tag": "",
"tag_id": ""
}
]
}
貼文與留言如何關聯
回覆與 reactions 任務都以貼文網址 post_url 建立;reactions 任務在蒐集後補上貼文的原生 ID(post_id),蒐集前為 null。示意的結果紀錄中,回覆以 is_reply 與 reply_to_author 標示回覆對象,is_quote 標示引用貼文,reply_count 為回覆數。mask_author 設為 true 時移除作者身分欄位,但保留 url 與 post_url,仍可對回原貼文。
歷史範圍與限制
- 搜尋、回覆與公開帳號的貼文時間軸任務:輪詢只回傳狀態與計數,結果的取回方式於開通時依帳號確認。
- 只給 end_date 而沒有 start_date 時,上游會忽略這個日期並套用預設區間。
- reactions 的 per_page 最多 1000;任務成功但清單暫時取不到時,回應會帶 error_message。
- max_scroll 為整數,搜尋任務不可為負數。
- 可回溯的期間與更新頻率,依專案範圍確認。
交付格式
任務狀態與 reactions 以 JSON 回傳。搜尋、回覆與時間軸結果的交付途徑(搜尋端點或專案資料集)於開通時依帳號確認;批次檔案或其他交付方式,依專案範圍確認。
申請試用
在下方表單勾選 Threads,說明要搜尋的關鍵字或帳號、是否需要回覆與 reactions,以及是否需要遮蔽作者欄位。我們會確認範圍與結果取回方式,並回覆試用與 API 金鑰的安排。
常見問題
- Threads API 可以拿到貼文的 reactions 嗎?
- 可以。POST /threads/reactions/task 帶貼文網址,任務成功後以 GET 取回 reactions 清單與分頁。
- Threads 搜尋任務完成後去哪裡拿結果?
- 搜尋任務的輪詢只回傳狀態與計數。結果的取回方式(透過搜尋端點或專案資料集)於開通時依帳號確認。
- 可以不要回傳作者資訊嗎?
- 可以。建立或輪詢時帶 mask_author=true,回應會移除作者身分欄位,url 與 post_url 保留。
- 要蒐集某個公開帳號的發文怎麼做?
- 使用 /threads/users/task 帶 author_id(開頭的 @ 可有可無),可加 start_date 與 end_date。
- Threads 資料是怎麼蒐集的?
- 以網路爬蟲蒐集 Threads 公開發布的內容。是否適用於您的用途,依用途與法域由買方法務評估,我們可提供來源與蒐集方式說明。