所有文章
OpenClaw 網頁爬取:如何從任何網站擷取資料

OpenClaw 網頁爬取:如何從任何網站擷取資料

|3 分鐘閱讀

OpenClaw 將網頁爬取從一項程式開發任務變成一場對話。告訴它你需要什麼資料、來自哪個網站、要什麼格式,它就會處理導航、擷取、分頁和格式化。

OpenClaw 爬取的運作方式

不同於傳統爬蟲需要 CSS 選擇器和 XPath,OpenClaw 像人類一樣閱讀頁面。它理解頁面結構、辨識資料表格,並根據語意來擷取資訊——而非依賴 DOM 位置。

你:"Go to producthunt.com and get me the top 10 products today
     with their names, taglines, and upvote counts."

OpenClaw:導航 → 閱讀 → 擷取 → 格式化 → 回傳表格。

設定

內建網頁讀取(無需設定)

OpenClaw 開箱即用就能擷取和閱讀任何公開網頁:

"Read the pricing page at example.com and extract all plan names and prices"

Headless Browser(適用於 JS 密集型網站)

對於需要 JavaScript 渲染的網站:

openclaw plugins install @anthropic/mcp-browser

這會加入一個 headless Chromium,可以處理:

  • 單頁應用程式(React、Vue、Angular)
  • 無限捲動頁面
  • 透過 AJAX 載入資料的網站
  • 有 cookie 同意牆的頁面

Browser Relay(適用於需要登入的網站)

Chrome 擴充功能的方式讓 OpenClaw 使用你已登入的瀏覽器 session:

  1. 安裝 OpenClaw Browser Relay 擴充功能
  2. 連接到你的 OpenClaw 實例
  3. 從你已經登入的網站爬取資料

實際爬取範例

價格監控

"Check the price of the Sony WH-1000XM5 on Amazon, BestBuy, and
 B&H Photo every 6 hours. Send me a Telegram alert if any
 price drops below $280."

OpenClaw 會建立一個 cron 排程任務:

  1. 訪問每個零售商
  2. 找到產品頁面
  3. 擷取當前價格
  4. 與你的門檻值比較
  5. 在 Telegram 上通知你優惠連結

競品研究

"Go to [competitor.com]/pricing and extract all plan names,
 prices, and feature lists. Format as a comparison table."

職缺列表

"Search LinkedIn Jobs for 'senior frontend engineer' in Berlin.
 Get the first 20 results with company name, salary range,
 and posting date."

房地產

"Find 3-bedroom apartments for rent in Austin, TX under $2500
 on Zillow. Get address, price, square footage, and listing URL."

新聞彙整

"Check TechCrunch, The Verge, and Ars Technica for articles
 about AI regulation published this week. List the headlines
 and URLs."

評論爬取

"Get the latest 20 reviews for [product] on Amazon. Include
 the rating, review title, and first two sentences of each."

處理擷取的資料

匯出為 CSV

"Scrape the product catalog at [url] and save it as a CSV file."

匯出為 JSON

"Extract all team members from [company]/about and return
 as JSON with name, role, and LinkedIn URL."

直接匯入試算表

"Extract the data table from [url] and add it to my
 Google Sheet named 'Market Research'."

多頁爬取

OpenClaw 自動處理分頁:

"Go to [blog.example.com] and get all article titles and
 dates. Follow the 'Next Page' link until you've collected
 at least 50 articles."

它會偵測分頁模式(下一頁按鈕、頁碼、無限捲動)並逐頁爬取。

排程爬取

結合爬取與 cron 排程,實現自動化資料收集:

"Every Monday morning, scrape the top posts from Hacker News
 and send me a summary of the top 10 on Telegram."
"Every day at 9am, check my competitor's changelog page for
 new entries. If there's anything new, summarize it and
 send it to me."

合乎道德的爬取

OpenClaw 遵循負責任的爬取準則:

  • 預設遵守 robots.txt
  • 請求速率限制,避免對伺服器造成過大負擔
  • 尊重 CAPTCHA——OpenClaw 不會繞過它們
  • 登入牆需要你明確的身份驗證(透過 Browser Relay)

對於明確禁止爬取的網站,OpenClaw 會通知你並建議替代方案(官方 API、RSS feed 等)。

限制

  • 強力反機器人網站:某些網站會主動偵測並封鎖自動化存取
  • CAPTCHA:OpenClaw 不會解決 CAPTCHA
  • 動態內容:非常複雜的 SPA 可能需要 headless browser 設定
  • 大規模爬取:OpenClaw 設計用於精準擷取,不適合爬取數百萬頁

已就緒的爬取實例

ClawTank 容器預先安裝了 headless browser runtime。部署後立即開始爬取——不需要安裝 Chromium 或設定 plugin。

準備好部署 OpenClaw 了嗎?

不需要 Docker、SSH、DevOps。不到 1 分鐘即可部署。

免費開始使用