Docs
登录
迁移到 Crawling API,使用 &scraper=name

相同的抓取器,更简洁的 endpoint,更多的参数。独立的 Scraper API 自 2024 年 10 月 1 日起已停止接受新用户注册 —— 现有集成将继续正常工作,没有计划关停,迁移只需修改一行 URL。

Endpoint

GEThttps://api.crawlbase.com/scraper?token=YOUR_TOKEN&url=ENCODED_URL&scraper=NAME
# Identical to the Crawling API, plus a required `scraper` parameter.
# Returns parsed JSON instead of raw HTML.

快速开始 —— Amazon 商品

curl 'https://api.crawlbase.com/scraper?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://www.amazon.com/dp/B08N5WRWNW' \
  --data-urlencode 'scraper=amazon-product-details' -G
from crawlbase import ScraperAPI

api = ScraperAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://www.amazon.com/dp/B08N5WRWNW',
    {'scraper': 'amazon-product-details'}
)
import json
data = json.loads(res['body'])
print(data['name'], data['price'])
const { ScraperAPI } = require('crawlbase');
const api = new ScraperAPI({ token: 'YOUR_TOKEN' });

const res = await api.get(
  'https://www.amazon.com/dp/B08N5WRWNW',
  { scraper: 'amazon-product-details' }
);
const data = JSON.parse(res.body);
console.log(data.name, data.price);

示例响应:

{
  "name": "Echo Dot (4th Gen) | Smart speaker with Alexa",
  "asin": "B08N5WRWNW",
  "brand": "Amazon",
  "price": "$49.99",
  "availability": "In Stock",
  "rating": 4.7,
  "reviews_count": 412903,
  "main_image": "https://m.media-amazon.com/images/I/61MZi+B-OBL.jpg",
  "images": ["…"],
  "features": ["Meet the all-new Echo Dot…"],
  "description": "Our most popular smart speaker…"
}

抓取器目录

以下是部分可用抓取器的代表性列表。将抓取器名称作为 scraper 参数传入即可。

Amazon

抓取器返回内容
amazon-product-details商品页面:名称、价格、评分、图片、特性
amazon-search-results搜索结果列表页:商品、分页、筛选条件
amazon-reviews评论页,包含评分、作者、日期、正文、有用计数
amazon-bestsellers按类别排序的畅销商品列表
amazon-questions顾客问答(Q&A)板块

Google

抓取器返回内容
google-serp搜索结果:自然搜索、广告、知识面板、相关搜索
google-shoppingShopping 标签页列表,包含商家、价格、评分
google-newsNews 标签页结果,包含来源、摘要、时间
google-maps地点页面:名称、地址、营业时间、评分、评论
google-scholar学术搜索结果,包含引用信息

社交网络

抓取器返回内容
linkedin-profile公开个人资料数据:工作经历、教育背景、技能
linkedin-company公司页面:规模、行业、总部地点
instagram-profile个人资料元数据、最近的帖子、粉丝数量
tiktok-profileTikTok 用户资料和最近的视频
youtube-channel频道元数据、订阅者数量、最近上传视频

其他电商平台

抓取器返回内容
ebay-product-detailseBay 商品列表数据
walmart-productWalmart 商品页面
yelp-businessYelp 商家列表,包含评论摘要
booking-hotelBooking.com 酒店页面,包含价格和设施信息
tripadvisor-attractionTripAdvisor 景点页面
没看到您需要的?

完整目录可在您的控制台中查看。每月都会新增抓取器。如果您需要为我们尚未覆盖的网站定制抓取器,请发邮件给我们

使用 autoparse 自动检测

如果您知道 URL 但不想查找对应的抓取器名称,可以在标准的 Crawling API endpoint 上使用 autoparse=true。我们会自动检测页面类型并应用匹配的抓取器。

curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://www.amazon.com/dp/B08N5WRWNW' \
  --data-urlencode 'autoparse=true' -G

# Crawlbase recognizes the Amazon URL and auto-applies amazon-product-details

参数

Scraper API endpoint 接受与 Crawling API 相同的结构,仅限于以下五个参数加上 scraper 名称。每个共享参数的详细说明以 Crawling API 参考文档为准 —— 此列表是旧版 /scraper endpoint 的独立参考。

token
string必填
您的私有 Crawlbase token。默认使用 Normal token;当与 javascript=true 配合时,请使用 JavaScript token。
url
string必填
要抓取的目标 URL。必须以 httphttps 开头,并完全经过 URL 编码。
scraper
string必填
要应用的抓取器名称。支持的抓取器请参见上方目录。
country
ISO 3166可选
从指定国家进行地理定位请求(例如 USGBDE)。可用的国家受套餐限制;完整国家列表请参阅 Crawling API parameters 参考文档。
javascript
booleanfalse
在抓取前使用真实的 Chrome 浏览器渲染页面。对于 SPA 和 JS 渲染页面,请设置 javascript=true每次请求消耗 2 个积分;需要使用 JavaScript token,而不是 Normal token。
premium
booleanfalse
通过 Crawlbase 的高级住宅网络路由请求,以应对更难绕过的反爬虫目标。每次请求消耗 10 个积分,与 javascript=true 配合时消耗 20 个积分。受套餐限制。

抓取器特定错误

代码含义
422未知的抓取器名称。请对照目录检查拼写。
423URL 与抓取器期望的模式不匹配(例如,在非商品 URL 上使用 amazon-product-details)。
425页面结构发生变化,抓取器无法提取数据。系统会自动上报,通常在数小时内修复。