LIHKG 連登爬蟲|關鍵字搜尋、貼文留言、香港輿情監控(免 API)
Pricing
from $2.00 / 1,000 帖子列表
LIHKG 連登爬蟲|關鍵字搜尋、貼文留言、香港輿情監控(免 API)
免登入抓連登(LIHKG)香港論壇:全站關鍵字搜尋、分台主題列表、貼文全文與所有留言,含推/踩數與時間,輸出 JSON/CSV/Excel。配合排程即為品牌關鍵字每日監控,只抓有新動靜的主題、成本不隨歷史膨脹。香港輿情監測、社群聆聽、品牌聲量分析必備。
Pricing
from $2.00 / 1,000 帖子列表
Rating
0.0
(0)
Developer
Chad
Maintained by CommunityActor stats
1
Bookmarked
3
Total users
0
Monthly active users
5 hours ago
Last modified
Categories
Share
LIHKG 連登爬蟲(免 API・免登入)
抓連登(LIHKG)香港論壇最新主題列表及完整貼文留言,走 api_v2 公開 JSON 端點,輸出結構化資料。
輸出欄位
主題列表 / 貼文主文(ThreadRow)
| 欄位名稱 | 型別 | 說明 |
|---|---|---|
| thread_id | string | 貼文 ID |
| title | string | null | 標題 |
| content | string | null | 貼文主文(列表模式為 null) |
| author | string | null | 作者暱稱 |
| category | string | null | 分台名稱 |
| reply_count | number | null | 回覆數 |
| like_count | number | null | 讚數 |
| dislike_count | number | null | 黑人問號數 |
| created_at | string | null | 發文時間(ISO 8601) |
| last_reply_at | string | null | 最後回覆時間(ISO 8601) |
| thread_url | string | 貼文網址 |
| source_mode | string | 抓取模式(thread-list / thread) |
| source_query | string | 查詢條件(分台 ID 或貼文 ID) |
| scraped_at | string | 抓取時間(ISO 8601) |
留言(ReplyRow)
| 欄位名稱 | 型別 | 說明 |
|---|---|---|
| reply_id | string | null | 留言 ID(post_id) |
| thread_id | string | 所屬貼文 ID |
| floor | number | null | 樓層(msg_num) |
| author | string | null | 作者暱稱 |
| content | string | null | 留言內容(已去除 HTML 標籤) |
| like_count | number | null | 讚數 |
| dislike_count | number | null | 黑人問號數 |
| created_at | string | null | 留言時間(ISO 8601) |
| scraped_at | string | 抓取時間(ISO 8601) |
模式說明
| 模式 | 輸入 | 輸出 | 計費 |
|---|---|---|---|
| thread-list | catIds(分台 ID 列表,可填 all) | 主題列表(ThreadRow) | $0.002/篇 |
| thread | threadIds / threadUrls | 貼文主文($0.008/篇)+所有留言($0.003/則) | 依數量 |
| search | keywords(搜尋關鍵字) | 全站搜尋結果(ThreadRow) | $0.002/篇 |
輸入欄位
| 欄位 | 型別 | 預設 | 說明 |
|---|---|---|---|
| mode | enum | thread-list | 模式:thread-list(列表)/ thread(完整貼文)/ search(關鍵字搜尋) |
| catIds | array | — | 分台 ID,例如 1(吹水台)、2(體育台)、5(時事台)。填 all 會展開成全部 37 個可發文分台(自動排除熱門/最新/自選台等彙整台);maxItems 是每個分台各自的上限 |
| threadIds | array | — | 貼文 ID 列表 |
| threadUrls | array | — | 貼文網址,自動抽出 ID |
| bulkInput | textarea | — | 批量貼上,一行一個,自動合併到對應欄位(搜尋模式下併入 keywords) |
| maxItems | integer | 50 | 最多抓幾篇(列表:每分台;貼文:總篇數;搜尋:每個關鍵字),上限 2000 |
| keywords | array | — | 搜尋模式:要搜尋的關鍵字(品牌名、產品名、地產商名)。列表模式:標題關鍵字過濾(留空不過濾) |
| order | enum | desc_reply_time | 搜尋模式排序:desc_reply_time(最新回覆優先,監控用)/ desc_create_time(最新發文優先)/ score(相關度優先,研究用) |
| dateFrom | string | — | 只抓這個時間之後有動靜(發文或最後回覆)的主題。格式:3d、12h、2w(相對時間)或 MM/DD/YY(絕對日期)。留空不過濾;有設定時會提早停止翻頁,排程監控更省成本 |
| proxyConfiguration | proxy | Apify datacenter proxy | 預設開啟;不用 proxy 會與其他 run 共用出口 IP 而被 LIHKG 限流(429)。自備 proxy 或本機測試才關 |
輸入範例
主題列表
{"mode": "thread-list","catIds": ["1", "5"],"maxItems": 100}
完整貼文及留言
{"mode": "thread","threadIds": ["4126423"],"maxItems": 50}
批量貼文網址
{"mode": "thread","threadUrls": ["https://lihkg.com/thread/4126423/page/1","https://lihkg.com/thread/4000000/page/1"],"maxItems": 50}
關鍵字搜尋
{"mode": "search","keywords": ["太古城"],"order": "desc_reply_time","maxItems": 100}
全部分台
{"mode": "thread-list","catIds": ["all"],"maxItems": 20}
香港品牌聲量監控
search 模式配合 dateFrom 即為「關鍵字監控」:排程每天跑一次,只抓當天新增或有新回覆的主題,成本固定不隨歷史資料膨脹。
{"mode": "search","keywords": ["你的品牌名"],"order": "desc_reply_time","dateFrom": "1d"}
用 Apify 排程(Schedule)設定每日觸發,即可自動累積每天的品牌聲量資料,不用手動重跑、也不會重複抓到舊資料。
想要跨平台聲量拼圖?搭配作者的其他繁中輿情 actor:Threads(threads-feed-scraper)、PTT(ptt-scraper,台灣論壇)、LIHKG(本 actor,香港)。親子王國、HK01 留言等其他香港論壇(hk-forums)即將推出。
注意事項
- 只抓公開內容,不需要帳號或 token
- 使用 api_v2 JSON 端點(不用瀏覽器,速度快、成本低)
- 留言內容已自動去除 HTML 標籤(
<br>、<img>、<span>等) - thread 模式:maxItems 限制的是貼文篇數,每篇留言全數抓取不受限
- search 模式:maxItems 限制的是每個關鍵字各自抓幾篇,不是總數
- 分項計費:啟動費 $0.005(一次)、列表/搜尋每篇 $0.002、貼文主文每篇 $0.008、留言每則 $0.003
- 連續 5 頁無新資料時自動停止,不空轉燒費用;設了 dateFrom 的話,整頁都比 dateFrom 舊就會直接停止翻頁(更省成本)
- LIHKG api_v2 未來有機會加上
X-LI-DEVICE標頭驗證或 challenge,並封鎖資料中心 IP。判斷方式:以 Apify cloud smoke test 結果為準(go/no-go);若被擋,備援方案是改用 Apify residential proxy(proxyConfiguration),不預先過度設計
常見問題(FAQ)
Q: 需要登入才能看嗎?
A: 不需要。本 Actor 只抓公開主題列表及留言,不涉及任何需要登入的功能。
Q: 可以同時抓多個分台嗎?
A: 可以。在 catIds 填多個 ID,或用 bulkInput 一行一個貼上。
Q: 留言的 HTML 要怎麼處理?
A: 已自動處理。content 欄位輸出的是純文字,HTML 標籤已去除,HTML 實體已解碼(& → &、< → < 等)。
Q: 為什麼 thread-list 模式的 content 是 null?
A: 列表 API 不返回貼文內容,只有標題和元資料。若需要內文,改用 thread 模式。
Q: search 模式跟 thread-list 的 keywords 過濾有什麼不同?
A: search 模式的 keywords 是送去 LIHKG 全站搜尋的查詢字,回傳的是搜尋結果(不限分台)。thread-list 模式的 keywords 只是在已抓到的分台列表裡做標題過濾,不會擴大搜尋範圍。
免責聲明
本工具僅供學術研究及合法商業分析用途。使用者應遵守 LIHKG 服務條款及相關法規。請勿以本工具進行任何侵害他人隱私、散布虛假資訊或其他違法行為。作者不對任何濫用行為承擔責任。
LIHKG 爬蟲、連登、香港輿情、論壇監控、品牌聲量、香港社群數據、關鍵字搜尋
📚 延伸教學與工具
這隻 actor 背後的實戰教學與免費工具,都在 AI Social API:
- 📖 教學:用 Apify + n8n + GPT 串一條免寫程式的論壇輿情 pipeline
- 📊 原創資料:亞洲論壇可爬性 × 成本對照表 — 13 個站實跑過:哪些直連就抓得到、哪些要 residential IP、每筆各多少錢
- 🛠 免費工具:論壇輿情快查 · Apify 成本試算
- 🤝 不想自己跑?我幫你每天跑——排程好每天送進你的 Google Sheet 或 Slack,每月 US$299 起。
由實際經營 40+ 隻上架 actor 的人維護。